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

Michael Niedermayer git at videolan.org
Thu Mar 21 20:15:08 EET 2019


ffmpeg | branch: release/4.0 | Michael Niedermayer <michael at niedermayer.cc> | Mon Feb 25 13:26:25 2019 +0100| [ccf6ca1701d8e5e7ecc697c983a369e2e87680b8] | 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=ccf6ca1701d8e5e7ecc697c983a369e2e87680b8
---

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

diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index 9c6f806655..dc28c83661 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