From fb1ff173f9b8f34e7541f782ddfc9a81d81ecafe Mon Sep 17 00:00:00 2001 From: jp9000 Date: Wed, 1 Jun 2016 19:19:34 -0700 Subject: [PATCH] libobs: Fix crash with 4:2:0 async source resolutions When using GPU conversion for 4:2:0 frames on async video sources, it would create a texture bigger than necessary and try to copy too much data from the frame, resulting in a crash. --- libobs/obs-source.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libobs/obs-source.c b/libobs/obs-source.c index 8b38923a0..634f7a4b4 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -1268,7 +1268,7 @@ static inline bool set_planar420_sizes(struct obs_source *source, size += size/2; source->async_convert_width = frame->width; - source->async_convert_height = (size / frame->width + 1) & 0xFFFFFFFE; + source->async_convert_height = size / frame->width; source->async_texture_format = GS_R8; source->async_plane_offset[0] = (int)(frame->data[1] - frame->data[0]); source->async_plane_offset[1] = (int)(frame->data[2] - frame->data[0]); @@ -1282,7 +1282,7 @@ static inline bool set_nv12_sizes(struct obs_source *source, size += size/2; source->async_convert_width = frame->width; - source->async_convert_height = (size / frame->width + 1) & 0xFFFFFFFE; + source->async_convert_height = size / frame->width; source->async_texture_format = GS_R8; source->async_plane_offset[0] = (int)(frame->data[1] - frame->data[0]); return true;