aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUrs Fleisch <ufleisch@users.sourceforge.net>2018-12-19 16:41:28 +0100
committerUrs Fleisch <ufleisch@users.sourceforge.net>2019-02-10 08:40:20 +0100
commit1cf176af61ceb5d125b55aba7fc4798008d5d901 (patch)
treee2b917380ba1d15c91e60161279309b0b4a9aaf7
parent5cb589a5b82c13ba8f0542e5e79629da7645cb3c (diff)
Do not ignore non zero RIFF padding if leading to parse error (#882)
-rw-r--r--taglib/riff/rifffile.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/taglib/riff/rifffile.cpp b/taglib/riff/rifffile.cpp
index 0af4d4b4..d3e1aa21 100644
--- a/taglib/riff/rifffile.cpp
+++ b/taglib/riff/rifffile.cpp
@@ -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++;
+ }
}
}