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;