[FFmpeg-cvslog] avcodec/gdv: Check available space before reading palette

Michael Niedermayer git at videolan.org
Sun Aug 13 02:05:45 EEST 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Aug 11 19:27:02 2017 +0200| [0561bd2fc2bff0dbe651d5998e9f129c43d25eb3] | committer: Michael Niedermayer

avcodec/gdv: Check available space before reading palette

Fixes: Timeout
Fixes: 2926/clusterfuzz-testcase-498711001458278

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=0561bd2fc2bff0dbe651d5998e9f129c43d25eb3
---

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

diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c
index b324e4f26e..dc91869edf 100644
--- a/libavcodec/gdv.c
+++ b/libavcodec/gdv.c
@@ -427,6 +427,8 @@ static int gdv_decode_frame(AVCodecContext *avctx, void *data,
     case 1:
         memset(gdv->frame + PREAMBLE_SIZE, 0, gdv->frame_size - PREAMBLE_SIZE);
     case 0:
+        if (bytestream2_get_bytes_left(gb) < 256*3)
+            return AVERROR_INVALIDDATA;
         for (i = 0; i < 256; i++) {
             unsigned r = bytestream2_get_byte(gb);
             unsigned g = bytestream2_get_byte(gb);



More information about the ffmpeg-cvslog mailing list