diff mbox series

[FFmpeg-devel,2/4] avcodec/hcadec: Check total_band_count against imdct_in size

Message ID 20200630202832.3672-2-michael@niedermayer.cc
State Accepted
Commit 2d96c945312d3f62e3f872bfb51a593afb40e09a
Headers show
Series [FFmpeg-devel,1/4] avcodec/loco: Fix integer overflow with large values from loco_get_rice() | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer June 30, 2020, 8:28 p.m. UTC
Fixes: index 128 out of bounds for type 'float [128]'
Fixes: 23465/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5089866596745216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/hcadec.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer July 2, 2020, 3:22 p.m. UTC | #1
On Tue, Jun 30, 2020 at 10:28:30PM +0200, Michael Niedermayer wrote:
> Fixes: index 128 out of bounds for type 'float [128]'
> Fixes: 23465/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5089866596745216
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/hcadec.c | 4 ++++
>  1 file changed, 4 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c
index 28e7d07cec..11cb157277 100644
--- a/libavcodec/hcadec.c
+++ b/libavcodec/hcadec.c
@@ -157,6 +157,10 @@  static av_cold int decode_init(AVCodecContext *avctx)
     } else
         return AVERROR_INVALIDDATA;
 
+    if (c->total_band_count > FF_ARRAY_ELEMS(c->ch->imdct_in))
+        return AVERROR_INVALIDDATA;
+
+
     while (get_bits_left(gb) >= 32) {
         chunk = get_bits_long(gb, 32);
         if (chunk == MKBETAG('v', 'b', 'r', 0)) {