On 11/10/13 11:51, Kostya Shishkov wrote: > On Fri, Oct 11, 2013 at 11:35:21AM +0200, Luca Barbato wrote: >> Sample-Id: 00000262-google >> Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind >> CC: [email protected] >> --- >> libavcodec/indeo4.c | 19 ++++++++++--------- >> 1 file changed, 10 insertions(+), 9 deletions(-) >> >> diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c >> index 3c749a9..b99c08e 100644 >> --- a/libavcodec/indeo4.c >> +++ b/libavcodec/indeo4.c >> @@ -370,15 +370,6 @@ static int decode_band_hdr(IVI45DecContext *ctx, >> IVIBandDesc *band, >> band->scan = scan_index_to_tab[scan_indx]; >> >> band->quant_mat = get_bits(&ctx->gb, 5); >> - if (band->quant_mat == 31) { >> - av_log(avctx, AV_LOG_ERROR, "Custom quant matrix >> encountered!\n"); >> - return AVERROR_INVALIDDATA; >> - } >> - if (band->quant_mat >= FF_ARRAY_ELEMS(quant_index_to_tab)) { >> - avpriv_request_sample(avctx, "Quantization matrix %d", >> - band->quant_mat); >> - return AVERROR_INVALIDDATA; >> - } >> } else { >> if (old_blk_size != band->blk_size) { >> av_log(avctx, AV_LOG_ERROR, >> @@ -416,6 +407,16 @@ static int decode_band_hdr(IVI45DecContext *ctx, >> IVIBandDesc *band, >> } >> >> if (band->blk_size == 8) { >> + if (band->quant_mat == 31) { >> + av_log(avctx, AV_LOG_ERROR, "Custom quant matrix >> encountered!\n"); >> + return AVERROR_INVALIDDATA; >> + } >> + >> + if (band->quant_mat >= FF_ARRAY_ELEMS(quant_index_to_tab)) { >> + avpriv_request_sample(avctx, "Quantization matrix %d", >> + band->quant_mat); >> + return AVERROR_INVALIDDATA; >> + } >> band->intra_base = >> &ivi4_quant_8x8_intra[quant_index_to_tab[band->quant_mat]][0]; >> band->inter_base = >> &ivi4_quant_8x8_inter[quant_index_to_tab[band->quant_mat]][0]; >> } else { >> -- > > why?
Because quant_mat can be inherited and the checks before were in the setting block. Alternatively on error I can set it to -1 and error out checking for quant_mat < -1 there. lu _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
