[FFmpeg-cvslog] avcodec/huffyuvdec: Check input buffer size

Michael Niedermayer git at videolan.org
Tue Feb 13 01:39:15 EET 2018


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Wed Jan 31 19:20:10 2018 +0100| [c402b672b7641e9002868ee26be82a01048f7aed] | committer: Michael Niedermayer

avcodec/huffyuvdec: Check input buffer size

Fixes: Timeout
Fixes: 5487/clusterfuzz-testcase-4696837035393024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 08c220d26cff51ca2f6896b65aebfa3accc67290)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/huffyuvdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index a700abb941..4285479351 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -913,6 +913,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     AVFrame *const p = data;
     int table_size = 0, ret;
 
+    if (buf_size < (width * height + 7)/8)
+        return AVERROR_INVALIDDATA;
+
     av_fast_padded_malloc(&s->bitstream_buffer,
                    &s->bitstream_buffer_size,
                    buf_size);



More information about the ffmpeg-cvslog mailing list