From b372723f6a60f362e7b007a4bac2fac68da90b13 Mon Sep 17 00:00:00 2001
From: Peter Ross <pross@xvid.org>
Date: Sun, 6 Nov 2011 12:14:31 +1100
Subject: [PATCH] wtvenc: ensure fat tables are padded to the sector boundary

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavformat/wtvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 887ee729f1b..d1c446ccb0d 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -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)
-- 
GitLab