[FFmpeg-cvslog] avcodec/agm: Check that there is available input in read_code()

Michael Niedermayer git at videolan.org
Wed Apr 24 18:07:44 EEST 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Apr  2 20:27:13 2019 +0200| [caa9b4ff89c00591a0730d2cc5db8693da8dffba] | committer: Michael Niedermayer

avcodec/agm: Check that there is available input in read_code()

Fixes: Timeout (46sec -> 7ms)
Fixes: 14030/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5721258760601600

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=caa9b4ff89c00591a0730d2cc5db8693da8dffba
---

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

diff --git a/libavcodec/agm.c b/libavcodec/agm.c
index 7dcfaff4ad..332e33897c 100644
--- a/libavcodec/agm.c
+++ b/libavcodec/agm.c
@@ -103,6 +103,9 @@ static int read_code(GetBitContext *gb, int *oskip, int *level, int *map, int mo
 {
     int len = 0, skip = 0, max;
 
+    if (get_bits_left(gb) < 2)
+        return AVERROR_INVALIDDATA;
+
     if (show_bits(gb, 2)) {
         switch (show_bits(gb, 4)) {
         case 1:



More information about the ffmpeg-cvslog mailing list