ID3v2: Bounds check a vector's size

If the provided vector is empty then `data[0]` dereferences a nullptr,
so add a check that this won't be the case before reading the encoding.
This commit is contained in:
bobsayshilol
2021-04-24 16:26:42 +01:00
committed by Urs Fleisch
parent 3391bd80c4
commit 1d3e080f04

View File

@ -117,6 +117,11 @@ void OwnershipFrame::parseFields(const ByteVector &data)
{
int pos = 0;
// Need at least 1 byte for the encoding
if(data.size() - pos < 1) {
return;
}
// Get the text encoding
d->textEncoding = String::Type(data[0]);
pos += 1;