flac/foreign_metadata: Fix for odd RIFF chunk size

Accept odd values to ckSize of RIFF chunk. FLAC should read these
but should avoid creating them.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
Closes: https://sourceforge.net/p/flac/support-requests/152/
Closes: https://sourceforge.net/p/flac/bugs/419/
This commit is contained in:
Erik de Castro Lopo 2015-07-10 19:20:24 +10:00
parent 5ff15bddeb
commit e771e7b6a7
1 changed files with 4 additions and 1 deletions

View File

@ -198,8 +198,11 @@ static FLAC__bool read_from_wave_(foreign_metadata_t *fm, FILE *f, const char **
}
if(!append_block_(fm, offset, 12, error))
return false;
if(!fm->is_rf64 || unpack32le_(buffer+4) != 0xffffffffu)
if(!fm->is_rf64 || unpack32le_(buffer+4) != 0xffffffffu) {
eof_offset = (FLAC__off_t)8 + (FLAC__off_t)unpack32le_(buffer+4);
if(eof_offset & 1) /* fix odd RIFF size */
eof_offset++;
}
while(!feof(f)) {
FLAC__uint32 size;
if((offset = ftello(f)) < 0) {