[FFmpeg-cvslog] avcodec/gdv: Check remaining output after decode 5/6/8/

Michael Niedermayer git at videolan.org
Fri May 31 23:46:23 EEST 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed May 29 01:12:39 2019 +0200| [5a6fc87443e29fceff632c6abe5fb34ee905012e] | committer: Michael Niedermayer

avcodec/gdv: Check remaining output after decode 5/6/8/

Improves: Timeout (355sec -> 97sec)
Improves: 14709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5704215281795072

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

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

 libavcodec/gdv.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c
index 9cf30c09e4..a5ce6b799e 100644
--- a/libavcodec/gdv.c
+++ b/libavcodec/gdv.c
@@ -308,7 +308,7 @@ static int decompress_5(AVCodecContext *avctx, unsigned skip)
             int len;
             int b = bytestream2_get_byte(gb);
             if (b == 0) {
-                break;
+                return 0;
             }
             if (b != 0xFF) {
                 len = b;
@@ -323,6 +323,8 @@ static int decompress_5(AVCodecContext *avctx, unsigned skip)
             lz_copy(pb, g2, off, len);
         }
     }
+    if (bytestream2_get_bytes_left_p(pb) > 0)
+        return AVERROR_INVALIDDATA;
     return 0;
 }
 
@@ -445,6 +447,9 @@ static int decompress_68(AVCodecContext *avctx, unsigned skip, unsigned use8)
         }
     }
 
+    if (bytestream2_get_bytes_left_p(pb) > 0)
+        return AVERROR_INVALIDDATA;
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list