summaryrefslogtreecommitdiff
path: root/libavcodec/mlpdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-09-30 00:44:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-10-04 23:47:54 +0200
commitf1f78e3cf4da658225067d9ef35cdb25541e5fe2 (patch)
treec433fcc2d31f70d9797f3abd20d2d3875d14325a /libavcodec/mlpdec.c
parent77164b2344eb67d61f973ebbbc8e0b88aaae027b (diff)
avcodec/mlpdec: add max channels check
Fixes: out of array access Fixes: 51648/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-4644322217164800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r--libavcodec/mlpdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 635f92895c..0b0eb75990 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -547,6 +547,9 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
return AVERROR_PATCHWELCOME;
}
+ if (max_channel + 1 > MAX_CHANNELS || max_channel + 1 < min_channel)
+ return AVERROR_INVALIDDATA;
+
s->min_channel = min_channel;
s->max_channel = max_channel;
s->coded_channels = ((1LL << (max_channel - min_channel + 1)) - 1) << min_channel;