diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2015-07-10 19:20:24 +1000 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2015-07-10 19:22:39 +1000 |
commit | e771e7b6a7e18e8adf3ea60203548379b58cb99a (patch) | |
tree | 6045ce70d63f0407dd848aeede544ef2ace45d7a /src/flac | |
parent | 5ff15bddeb1779d2e95a17a56a3aa04036fc7354 (diff) | |
download | flac-e771e7b6a7e18e8adf3ea60203548379b58cb99a.tar.gz |
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/
Diffstat (limited to 'src/flac')
-rw-r--r-- | src/flac/foreign_metadata.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/flac/foreign_metadata.c b/src/flac/foreign_metadata.c index 8afe6940..d01f4668 100644 --- a/src/flac/foreign_metadata.c +++ b/src/flac/foreign_metadata.c @@ -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) { |