[FFmpeg-cvslog] avcodec/prosumer: Check decoded size

Michael Niedermayer git at videolan.org
Mon Mar 25 16:03:44 EET 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Mar 19 23:51:10 2019 +0100| [c0ca67ba4083762cf5c8eeb1229b333777f25159] | committer: Michael Niedermayer

avcodec/prosumer: Check decoded size

Fixes: Timeout (longer than i had patience for -> 2sec)
Fixes: 13205/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PROSUMER_fuzzer-5105644481282048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c0ca67ba4083762cf5c8eeb1229b333777f25159
---

 libavcodec/prosumer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/prosumer.c b/libavcodec/prosumer.c
index ce3cbdbb73..f064f7bad7 100644
--- a/libavcodec/prosumer.c
+++ b/libavcodec/prosumer.c
@@ -159,6 +159,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
     ret = decompress(&s->gb, AV_RL32(avpkt->data + 28) >> 1, &s->pb, s->lut);
     if (ret < 0)
         return ret;
+    if (bytestream2_get_bytes_left_p(&s->pb) > s->size * (int64_t)avctx->discard_damaged_percentage / 100)
+        return AVERROR_INVALIDDATA;
     vertical_predict((uint32_t *)s->decbuffer, 0, (uint32_t *)s->initial_line, s->stride, 1);
     vertical_predict((uint32_t *)s->decbuffer, s->stride, (uint32_t *)s->decbuffer, s->stride, avctx->height - 1);
 



More information about the ffmpeg-cvslog mailing list