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

Michael Niedermayer git at videolan.org
Fri May 10 22:02:59 EEST 2019


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

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

diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index ff8e3922be..56270d25b9 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