aboutsummaryrefslogtreecommitdiffstats
path: root/taglib/flac
diff options
context:
space:
mode:
authorTsuda Kageyu <tsuda.kageyu@gmail.com>2015-07-29 20:52:56 +0900
committerTsuda Kageyu <tsuda.kageyu@gmail.com>2015-07-29 20:52:56 +0900
commit6f944b02918c61528b977442c64c9b4bfd50078a (patch)
tree5f7ded8b8129982ad71bedc2bb3506e0863f1a81 /taglib/flac
parente90b5e5f2faded598688c48dd3bdd2fc6cd5cbab (diff)
Make FLAC::File tolerant to zero-sized padding blocks.
Diffstat (limited to 'taglib/flac')
-rw-r--r--taglib/flac/flacfile.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/taglib/flac/flacfile.cpp b/taglib/flac/flacfile.cpp
index 823170aa..6df8f6b9 100644
--- a/taglib/flac/flacfile.cpp
+++ b/taglib/flac/flacfile.cpp
@@ -421,9 +421,15 @@ void FLAC::File::scan()
isLastBlock = (header[0] & 0x80) != 0;
length = header.toUInt(1U, 3U);
- ByteVector data = readBlock(length);
- if(data.size() != length || length == 0) {
- debug("FLAC::File::scan() -- FLAC stream corrupted");
+ if(length == 0 && blockType != MetadataBlock::Padding) {
+ debug("FLAC::File::scan() -- Zero-sized metadaba block found");
+ setValid(false);
+ return;
+ }
+
+ const ByteVector data = readBlock(length);
+ if(data.size() != length) {
+ debug("FLAC::File::scan() -- Failed to read a metadata block");
setValid(false);
return;
}
@@ -446,7 +452,7 @@ void FLAC::File::scan()
block = picture;
}
else {
- debug("FLAC::File::scan() -- invalid picture found, discarting");
+ debug("FLAC::File::scan() -- invalid picture found, discarding");
delete picture;
}
}