mirror of https://git.ffmpeg.org/ffmpeg.git
swscale/swscale_unscaled: Fix odd height inputs for bayer_to_yv12_wrapper()
Fixes: 372d2df1f04b49e25f109f07f90b1505/asan_heap-oob_2835d2e_8501_99e0114d7ba3a6db885d0b4684d200c1.cine
Fixes out of array read
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 757248ea3c
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
262192a48b
commit
93c675d6a6
|
@ -1109,6 +1109,8 @@ static int bayer_to_yv12_wrapper(SwsContext *c, const uint8_t* src[], int srcStr
|
|||
default: return 0;
|
||||
}
|
||||
|
||||
av_assert0(srcSliceH > 1);
|
||||
|
||||
copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table);
|
||||
srcPtr += 2 * srcStride[0];
|
||||
dstY += 2 * dstStride[0];
|
||||
|
@ -1123,6 +1125,9 @@ static int bayer_to_yv12_wrapper(SwsContext *c, const uint8_t* src[], int srcStr
|
|||
dstV += dstStride[1];
|
||||
}
|
||||
|
||||
if (i + 1 == srcSliceH) {
|
||||
copy(srcPtr, -srcStride[0], dstY, dstU, dstV, -dstStride[0], c->srcW, c->input_rgb2yuv_table);
|
||||
} else if (i < srcSliceH)
|
||||
copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table);
|
||||
return srcSliceH;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue