Commit 29545741 authored by Michael Niedermayer's avatar Michael Niedermayer

indeo4: check quant_mat more fully.

quant_mats valid range depends on the block size.
This fixes a global array overread.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 53253a0b
...@@ -420,7 +420,11 @@ static int decode_band_hdr(IVI4DecContext *ctx, IVIBandDesc *band, ...@@ -420,7 +420,11 @@ static int decode_band_hdr(IVI4DecContext *ctx, IVIBandDesc *band,
} }
band->quant_mat = quant_mat; band->quant_mat = quant_mat;
} }
if (quant_index_to_tab[band->quant_mat] > 4 && band->blk_size == 4) {
av_log(avctx, AV_LOG_ERROR, "Invalid quant matrix for 4x4 block encountered!\n");
band->quant_mat = 0;
return AVERROR_INVALIDDATA;
}
/* decode block huffman codebook */ /* decode block huffman codebook */
if (ff_ivi_dec_huff_desc(&ctx->gb, get_bits1(&ctx->gb), IVI_BLK_HUFF, if (ff_ivi_dec_huff_desc(&ctx->gb, get_bits1(&ctx->gb), IVI_BLK_HUFF,
&band->blk_vlc, avctx)) &band->blk_vlc, avctx))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment