diff --git a/libavcodec/alac.c b/libavcodec/alac.c index a4e899b4de..36477c9eb6 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -325,6 +325,9 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index, decorr_shift = get_bits(&alac->gb, 8); decorr_left_weight = get_bits(&alac->gb, 8); + if (channels == 2 && decorr_left_weight && decorr_shift > 31) + return AVERROR_INVALIDDATA; + for (ch = 0; ch < channels; ch++) { prediction_type[ch] = get_bits(&alac->gb, 4); lpc_quant[ch] = get_bits(&alac->gb, 4);