diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-02 21:27:13 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-24 18:05:02 +0300 |
commit | caa9b4ff89c00591a0730d2cc5db8693da8dffba (patch) | |
tree | 612adc072f530afc409a4120d99868a8607de908 /libavcodec/agm.c | |
parent | d0ca749adbf266f3bd9028f4d50530ecfe30a5a8 (diff) |
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@niedermayer.cc>
Diffstat (limited to 'libavcodec/agm.c')
-rw-r--r-- | libavcodec/agm.c | 3 |
1 files changed, 3 insertions, 0 deletions
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: |