diff mbox

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

Message ID 20190225125619.11016-1-michael@niedermayer.cc
State Accepted
Commit 951bb7632fe6e3bb1a9c3b47610705871e471f34
Headers show

Commit Message

Michael Niedermayer Feb. 25, 2019, 12:56 p.m. UTC
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@niedermayer.cc>
---
 libavcodec/aic.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer March 3, 2019, 11:07 a.m. UTC | #1
On Mon, Feb 25, 2019 at 01:56:19PM +0100, Michael Niedermayer wrote:
> 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@niedermayer.cc>
> ---
>  libavcodec/aic.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]
diff mbox

Patch

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);