[FFmpeg-cvslog] avcodec/aic: Check remaining bits in aic_decode_coeffs()

Michael Niedermayer git at videolan.org
Thu Mar 28 18:34:39 EET 2019


ffmpeg | branch: release/3.4 | Michael Niedermayer <michael at niedermayer.cc> | Mon Feb 25 13:26:25 2019 +0100| [7cc9a207919f4ddda55501d2a05fc410ec6c04f8] | committer: Michael Niedermayer

avcodec/aic: Check remaining bits in aic_decode_coeffs()

Fixes: Timeout (78 seconds -> 2 seconds)
Fixes: 13186/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AIC_fuzzer-5639516533030912

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 951bb7632fe6e3bb1a9c3b47610705871e471f34)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index 67d78c5ddd..77f342e6d6 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -208,6 +208,9 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,
     int mb, idx;
     unsigned val;
 
+    if (get_bits_left(gb) < 5)
+        return AVERROR_INVALIDDATA;
+
     has_skips  = get_bits1(gb);
     coeff_type = get_bits1(gb);
     coeff_bits = get_bits(gb, 3);



More information about the ffmpeg-cvslog mailing list