aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-22 22:02:32 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 11:30:44 +0100
commit27b1e6cd86455a6f82dfc098760d50bd8481c50f (patch)
tree9b4db970f13869752f83b0a9bd8843cef190a362
parentd05aa7459f7ed3cc414957c254bab4505d2dae91 (diff)
downloadffmpeg-27b1e6cd86455a6f82dfc098760d50bd8481c50f.tar.gz
avcodec/atrac3plus: Check split point in fill mode 3
Fixes: index 32 out of bounds for type 'int [32]' Fixes: 18350/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3P_fuzzer-5643794862571520 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit de5102fd92de8d353fdf060375ed3ce859c83977) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/atrac3plus.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c
index 3e3bba801b..f135606e2a 100644
--- a/libavcodec/atrac3plus.c
+++ b/libavcodec/atrac3plus.c
@@ -456,6 +456,10 @@ static int decode_channel_wordlen(GetBitContext *gb, Atrac3pChanUnitCtx *ctx,
} else if (chan->fill_mode == 3) {
pos = ch_num ? chan->num_coded_vals + chan->split_point
: ctx->num_quant_units - chan->split_point;
+ if (pos > FF_ARRAY_ELEMS(chan->qu_wordlen)) {
+ av_log(avctx, AV_LOG_ERROR, "Split point beyond array\n");
+ pos = FF_ARRAY_ELEMS(chan->qu_wordlen);
+ }
for (i = chan->num_coded_vals; i < pos; i++)
chan->qu_wordlen[i] = 1;
}