mirror of
https://github.com/taglib/taglib.git
synced 2026-04-12 17:09:50 -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 <ufleisch@users.sourceforge.net>
This commit is contained in:
@ -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