]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/gdv: Check for truncated tags in decompress_5()
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 25 Feb 2019 00:26:30 +0000 (01:26 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 3 Mar 2019 12:17:02 +0000 (13:17 +0100)
Testcase: 13169/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5666354038833152

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

index c5d80f43f63124f834235cd3e912901ee67b316c..183286b55f178f335fa9ff12e40bf97cc6db440e 100644 (file)
@@ -294,6 +294,8 @@ static int decompress_5(AVCodecContext *avctx, unsigned skip)
 
     while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
         int tag = read_bits2(&bits, gb);
+        if (bytestream2_get_bytes_left(gb) < 1)
+            return AVERROR_INVALIDDATA;
         if (tag == 0) {
             bytestream2_put_byte(pb, bytestream2_get_byte(gb));
         } else if (tag == 1) {