From 810cd0dd9c0350b2a108a73a8ec2f4f1919c4a27 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Thu, 7 Feb 2013 10:00:40 +0000 Subject: [PATCH] riff: chunks must be at 2 byte boundary Fixes #2244. Signed-off-by: Paul B Mahol --- libavformat/riff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/riff.c b/libavformat/riff.c index 0df5c8c7e3..352bb561e9 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -428,9 +428,11 @@ void ff_end_tag(AVIOContext *pb, int64_t start) int64_t pos; pos = avio_tell(pb); + if (pos & 1) + avio_w8(pb, 0); avio_seek(pb, start - 4, SEEK_SET); avio_wl32(pb, (uint32_t)(pos - start)); - avio_seek(pb, pos, SEEK_SET); + avio_seek(pb, FFALIGN(pos, 2), SEEK_SET); } /* WAVEFORMATEX header */