ffmpeg | branch: release/3.4 | Michael Niedermayer <mich...@niedermayer.cc> | Sat Jun 23 23:37:10 2018 +0200| [d56eed37d195fe7b12ba3b00160032240cb06ea8] | committer: Michael Niedermayer
avcodec/magicyuv: Check bits left in flags&1 branch Fixes: Timeout Fixes: 8690/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MAGICYUV_fuzzer-6542020913922048 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <one...@gmail.com> Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> (cherry picked from commit 7719b8ccc790b6e1325af0afe2b65e2334a7173c) Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d56eed37d195fe7b12ba3b00160032240cb06ea8 --- libavcodec/magicyuv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c index 3c1a89077b..cc1c63072b 100644 --- a/libavcodec/magicyuv.c +++ b/libavcodec/magicyuv.c @@ -240,6 +240,8 @@ static int magy_decode_slice10(AVCodecContext *avctx, void *tdata, dst = (uint16_t *)p->data[i] + j * sheight * stride; if (flags & 1) { + if (get_bits_left(&gb) < bps * width * height) + return AVERROR_INVALIDDATA; for (k = 0; k < height; k++) { for (x = 0; x < width; x++) dst[x] = get_bits(&gb, bps); @@ -371,6 +373,8 @@ static int magy_decode_slice(AVCodecContext *avctx, void *tdata, dst = p->data[i] + j * sheight * stride; if (flags & 1) { + if (get_bits_left(&gb) < 8* width * height) + return AVERROR_INVALIDDATA; for (k = 0; k < height; k++) { for (x = 0; x < width; x++) dst[x] = get_bits(&gb, 8); _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog