wtvenc: ensure fat tables are padded to the sector boundary
authorPeter Ross <pross@xvid.org>
Sun, 6 Nov 2011 01:14:31 +0000 (12:14 +1100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 6 Nov 2011 01:40:31 +0000 (02:40 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/wtvenc.c

index 887ee72..d1c446c 100644 (file)
@@ -532,7 +532,7 @@ static void write_fat(AVIOContext *pb, int start_sector, int nb_sectors, int shi
         avio_wl32(pb, start_sector + (i << shift));
     }
     // pad left sector pointer size
-    write_pad(pb, WTV_SECTOR_SIZE - (nb_sectors << 2));
+    write_pad(pb, WTV_SECTOR_SIZE - ((nb_sectors << 2) % WTV_SECTOR_SIZE));
 }
 
 static int write_fat_sector(AVFormatContext *s, int64_t start_pos, int nb_sectors, int sector_bits, int depth)