mirror of
https://github.com/taglib/taglib.git
synced 2026-04-12 17:09:50 -04:00
Verify the ID3v2 version and revision are not 0xFF (#1301)
This commit is contained in:
@ -201,12 +201,19 @@ void Header::parse(const ByteVector &data)
|
||||
if(std::any_of(sizeData.cbegin(), sizeData.cend(),
|
||||
[](unsigned char size) { return size >= 128; })) {
|
||||
d->tagSize = 0;
|
||||
debug("TagLib::ID3v2::Header::parse() - One of the size bytes in the id3v2 header was greater than the allowed 128.");
|
||||
debug("TagLib::ID3v2::Header::parse() - One of the size bytes in the ID3v2 header was greater than the allowed 128.");
|
||||
return;
|
||||
}
|
||||
|
||||
// The first three bytes, data[0..2], are the File Identifier, "ID3". (structure 3.1 "file identifier")
|
||||
|
||||
// 3.1 states: "Version or revision will never be $FF."
|
||||
if(static_cast<unsigned char>(data[3]) == 0xFF || static_cast<unsigned char>(data[4]) == 0xFF) {
|
||||
d->tagSize = 0;
|
||||
debug("TagLib::ID3v2::Header::parse() - The version or revision in the ID3v2 header was 0xFF.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Read the version number from the fourth and fifth bytes.
|
||||
d->majorVersion = data[3]; // (structure 3.1 "major version")
|
||||
d->revisionNumber = data[4]; // (structure 3.1 "revision number")
|
||||
|
||||
Reference in New Issue
Block a user