Merge commit 'cd78e934c246d1b2510f8fba0abfe40bb75795f6'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 14 Jul 2013 10:48:13 +0000 (12:48 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 14 Jul 2013 11:08:13 +0000 (13:08 +0200)
* commit 'cd78e934c246d1b2510f8fba0abfe40bb75795f6':
  indeo4: Validate scantable dimension

See: 92f7f1db421ee8b3431534fa09e8050ba622c33a
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/indeo4.c

@@@ -352,22 -346,22 +352,28 @@@ static int decode_band_hdr(IVI45DecCont
              band->inv_transform = transforms[transform_id].inv_trans;
              band->dc_transform  = transforms[transform_id].dc_trans;
              band->is_2d_trans   = transforms[transform_id].is_2d_trans;
 +            band->transform_size= (transform_id < 10) ? 8 : 4;
  
              scan_indx = get_bits(&ctx->gb, 4);
-             if ((scan_indx>4 && scan_indx<10) != (band->blk_size==4)) {
-                 av_log(avctx, AV_LOG_ERROR, "mismatching scan table!\n");
-                 return AVERROR_INVALIDDATA;
-             }
              if (scan_indx == 15) {
                  av_log(avctx, AV_LOG_ERROR, "Custom scan pattern encountered!\n");
                  return AVERROR_INVALIDDATA;
              }
 -                if (band->blk_size != 4)
+             if (scan_indx > 4 && scan_indx < 10) {
 -            } else if (band->blk_size != 8)
++                if (band->blk_size != 4) {
++                    av_log(avctx, AV_LOG_ERROR, "mismatching scan table!\n");
+                     return AVERROR_INVALIDDATA;
++                }
++            } else if (band->blk_size != 8) {
++                av_log(avctx, AV_LOG_ERROR, "mismatching scan table!\n");
+                 return AVERROR_INVALIDDATA;
++            }
              band->scan = scan_index_to_tab[scan_indx];
 +            band->scan_size = band->blk_size;
  
 -            band->quant_mat = get_bits(&ctx->gb, 5);
 -            if (band->quant_mat == 31) {
 +            quant_mat = get_bits(&ctx->gb, 5);
 +            if (quant_mat == 31) {
                  av_log(avctx, AV_LOG_ERROR, "Custom quant matrix encountered!\n");
                  return AVERROR_INVALIDDATA;
              }