ID3v2: Return early from decode() on invalid data

The while loop in this function assumes that `data.end() - 1` is less
than `data.end()`, which isn't the case if `data` is empty since
`data.end()` can be a nullptr.
This commit is contained in:
bobsayshilol
2021-05-02 12:14:27 +02:00
committed by Urs Fleisch
parent f2eb331696
commit 51ae5748cb
+4
View File
@@ -74,6 +74,10 @@ ByteVector SynchData::fromUInt(unsigned int value)
ByteVector SynchData::decode(const ByteVector &data)
{
if (data.size() == 0) {
return ByteVector();
}
// We have this optimized method instead of using ByteVector::replace(),
// since it makes a great difference when decoding huge unsynchronized frames.