rolinh/libgwavi

Incorrect Data Padding for Audio and Video Chunks

mjbudd77 opened this issue · 1 comments

Per microsoft AVI RIFF File Reference documentation: For chunk data blocks: The data is always padded to nearest WORD boundary. ckSize gives the size of the valid data in the chunk; it does not include the padding, the size of ckID, or the size of ckSize.
WORD data size 2 is bytes. gwavi.c Line 241 using a 4 byte pad. It should be 2. Also, the size of the pad is being added into the size of the chunk and it should not be.

maxi_pad = len % 4;

Here is where the size of the padding is incorrectly being added in to ckSize.

if (write_int(gwavi->out, (unsigned int)(len + maxi_pad)) == -1) {