mirror of
https://github.com/taglib/taglib.git
synced 2026-09-08 02:27:02 -04:00
Add check for ID3v2 frame data length (#1300)
Also fix some wrong frame sizes in the unit tests. --------- Co-authored-by: Urs Fleisch <[email protected]>
This commit is contained in:
co-authored by
Urs Fleisch
parent
51f431c96a
commit
397b6c1de3
@@ -295,6 +295,13 @@ ByteVector Frame::fieldData(const ByteVector &frameData) const
|
||||
frameDataLength = SynchData::toUInt(frameData.mid(headerSize, 4));
|
||||
frameDataOffset += 4;
|
||||
}
|
||||
if(frameData.size() >= headerSize &&
|
||||
frameDataOffset + frameDataLength > frameData.size()) {
|
||||
// The first check is needed because some "dual purpose" frame constructors
|
||||
// call this method with only the frame ID, i.e. without a complete header.
|
||||
debug("Invalid frame data length");
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
if(zlib::isAvailable() && d->header->compression() && !d->header->encryption()) {
|
||||
if(frameData.size() <= frameDataOffset) {
|
||||
|
||||
Reference in New Issue
Block a user