Accept WAV files with garbage appended (#973)

This will allow editing the tags of WAV files which have data
appended at the end. The corresponding unit test checks that the
original contents are still available after editing the metadata
of such files.
This commit is contained in:
Urs Fleisch
2020-12-06 08:56:35 +01:00
parent 91b00b17b2
commit 2dd6931eee
3 changed files with 46 additions and 6 deletions

View File

@ -302,13 +302,11 @@ void RIFF::File::read()
if(!isValidChunkName(chunkName)) {
debug("RIFF::File::read() -- Chunk '" + chunkName + "' has invalid ID");
setValid(false);
break;
}
if(static_cast<long long>(offset) + 8 + chunkSize > length()) {
debug("RIFF::File::read() -- Chunk '" + chunkName + "' has invalid size (larger than the file size)");
setValid(false);
break;
}