avcodec/utvideodec: fix assumtation that slice_height >= 1

Fixes out of array read
Fixes: asan_heap-oob_2573085_3783_utvideo_rgba_median.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-11-10 19:44:20 +01:00
parent e981de81fe
commit 7656c4c6e6

View File

@ -224,7 +224,7 @@ static void restore_median(uint8_t *src, int step, int stride,
A = bsrc[i];
}
bsrc += stride;
if (slice_height == 1)
if (slice_height <= 1)
continue;
// second line - first element has top prediction, the rest uses median
C = bsrc[-stride];
@ -284,7 +284,7 @@ static void restore_median_il(uint8_t *src, int step, int stride,
A = bsrc[stride + i];
}
bsrc += stride2;
if (slice_height == 1)
if (slice_height <= 1)
continue;
// second line - first element has top prediction, the rest uses median
C = bsrc[-stride2];