mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Merge pull request #883 from ufleisch/riff-padding
Do not ignore non zero RIFF padding if leading to parse error (#882)
This commit is contained in:
commit
3c78c4cfc9
@ -325,9 +325,20 @@ void RIFF::File::read()
|
||||
if(offset & 1) {
|
||||
seek(offset);
|
||||
const ByteVector iByte = readBlock(1);
|
||||
if(iByte.size() == 1 && iByte[0] == '\0') {
|
||||
chunk.padding = 1;
|
||||
offset++;
|
||||
if(iByte.size() == 1) {
|
||||
bool skipPadding = iByte[0] == '\0';
|
||||
if(!skipPadding) {
|
||||
// Padding byte is not zero, check if it is good to ignore it
|
||||
const ByteVector fourCcAfterPadding = readBlock(4);
|
||||
if(isValidChunkName(fourCcAfterPadding)) {
|
||||
// Use the padding, it is followed by a valid chunk name.
|
||||
skipPadding = true;
|
||||
}
|
||||
}
|
||||
if(skipPadding) {
|
||||
chunk.padding = 1;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user