Fix reading empty ID3v1 fields

This commit is contained in:
Martchus 2021-05-09 12:15:00 +02:00
parent db4e1a480a
commit 98f6b268a5
1 changed files with 4 additions and 1 deletions

View File

@ -283,10 +283,13 @@ void Id3v1Tag::ensureTextValuesAreProperlyEncoded()
void Id3v1Tag::readValue(TagValue &value, size_t maxLength, const char *buffer)
{
const char *end = buffer + maxLength - 1;
while ((*end == 0x0 || *end == ' ') && end > buffer) {
while ((*end == 0x0 || *end == ' ') && end >= buffer) {
--end;
--maxLength;
}
if (buffer == end) {
return;
}
if (maxLength >= 3 && BE::toUInt24(buffer) == 0x00EFBBBF) {
value.assignData(buffer + 3, maxLength - 3, TagDataType::Text, TagTextEncoding::Utf8);
} else {