OSDN Git Service

indeo4: check that num_mbs matches
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 31 Mar 2012 19:42:50 +0000 (21:42 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 31 Mar 2012 19:42:50 +0000 (21:42 +0200)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/indeo4.c

index 9b013e8..3dd58dc 100644 (file)
@@ -490,6 +490,11 @@ static int decode_mb_info(IVI4DecContext *ctx, IVIBandDesc *band,
     mv_scale = (ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3);
     mv_x = mv_y = 0;
 
+    if (((tile->width + band->mb_size-1)/band->mb_size) * ((tile->height + band->mb_size-1)/band->mb_size) != tile->num_MBs) {
+        av_log(avctx, AV_LOG_ERROR, "num_MBs mismatch %d %d %d %d\n", tile->width, tile->height, band->mb_size, tile->num_MBs);
+        return -1;
+    }
+
     for (y = tile->ypos; y < tile->ypos + tile->height; y += band->mb_size) {
         mb_offset = offs;