[flac-dev] [PATCH] Fix for odd RIFF size

lvqcl lvqcl.mail at gmail.com
Mon Jul 13 11:04:14 PDT 2015


Brian Willoughby wrote:

> The ckSize field can be odd to represent the size of the valid data.
>
> However, the chunk itself must always be an even size. This requires a padding byte at the end of a chunk before the next chunk can begin, or before the end of file. The latter case is the one that most often occurs in buggy RIFF writing programs - the last chunk will have an odd ckSize and the file will be one byte shorter than a valid RIFF.



The problem was in the size of RIFF chunk.
Should RIFF chunk size include the padding byte of a last chunk?

For example, a program writes a RIFF WAV file which contains
16-byte 'fmt ' chunk and 132219-byte 'data' chunk.

Is 132255 (= 4 + 8 + 16 + 8 + 132219) the correct size of RIFF chunk, or should it
be equal to 132256 (= 4 + 8 + 16 + 8 + 132219 + 1)?


More information about the flac-dev mailing list