From 1d3e080f0487737363827b48e8a20ad5f81c6c6d Mon Sep 17 00:00:00 2001 From: bobsayshilol Date: Sat, 24 Apr 2021 16:26:42 +0100 Subject: [PATCH] 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. --- taglib/mpeg/id3v2/frames/ownershipframe.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/taglib/mpeg/id3v2/frames/ownershipframe.cpp b/taglib/mpeg/id3v2/frames/ownershipframe.cpp index 0b180dbf..3173d1fc 100644 --- a/taglib/mpeg/id3v2/frames/ownershipframe.cpp +++ b/taglib/mpeg/id3v2/frames/ownershipframe.cpp @@ -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;