[FFmpeg-cvslog] avcodec/siren: Check available bits in decode_envelope()

Michael Niedermayer git at videolan.org
Wed Sep 29 20:53:18 EEST 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Sep 28 00:25:20 2021 +0200| [109113b54f6fa7b880f66c797f7ab49d65dc7167] | committer: Michael Niedermayer

avcodec/siren: Check available bits in decode_envelope()

Fixes: Timeout
Fixes: 39089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSNSIREN_fuzzer-6677219854909440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: James Almer <jamrial at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/siren.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/siren.c b/libavcodec/siren.c
index 6909ebbf2e..6cbb3e3ba7 100644
--- a/libavcodec/siren.c
+++ b/libavcodec/siren.c
@@ -447,6 +447,8 @@ static int decode_envelope(SirenContext *s, GetBitContext *gb,
         int index = 0;
 
         do {
+            if (get_bits_left(gb) < 4)
+                return AVERROR_INVALIDDATA;
             index = differential_decoder_tree[i - 1][index][get_bits1(gb)];
         } while (index > 0);
 
@@ -724,9 +726,11 @@ static int siren_decode(AVCodecContext *avctx, void *data,
 
     skip_bits(gb, s->sample_rate_bits);
 
-    decode_envelope(s, gb, s->number_of_regions,
+    ret = decode_envelope(s, gb, s->number_of_regions,
                     s->decoder_standard_deviation,
                     s->absolute_region_power_index, s->esf_adjustment);
+    if (ret < 0)
+        return ret;
 
     rate_control = get_bits(gb, 4);
 



More information about the ffmpeg-cvslog mailing list