indeo4: Check the block size if reusing the band configuration
authorLuca Barbato <lu_zero@gentoo.org>
Fri, 11 Oct 2013 08:51:53 +0000 (10:51 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Sat, 12 Oct 2013 23:38:20 +0000 (01:38 +0200)
Sample-Id: 00000287-google

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/indeo4.c

index 042529f..3c749a9 100644 (file)
@@ -293,6 +293,7 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
 
     band->is_empty = get_bits1(&ctx->gb);
     if (!band->is_empty) {
+        int old_blk_size = band->blk_size;
         /* skip header size
          * If header size is not given, header size is 4 bytes. */
         if (get_bits1(&ctx->gb))
@@ -378,6 +379,13 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
                                       band->quant_mat);
                 return AVERROR_INVALIDDATA;
             }
+        } else {
+            if (old_blk_size != band->blk_size) {
+                av_log(avctx, AV_LOG_ERROR,
+                       "The band block size does not match the configuration "
+                       "inherited\n");
+                return AVERROR_INVALIDDATA;
+            }
         }
 
         /* decode block huffman codebook */