[FFmpeg-devel] [PATCH 3/3] avcodec/mlpdec: add max channels check

Michael Niedermayer michael at niedermayer.cc
Fri Sep 30 02:09:27 EEST 2022


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 at niedermayer.cc>
---
 libavcodec/mlpdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 635f92895c5..0b0eb759901 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;
-- 
2.17.1



More information about the ffmpeg-devel mailing list