From f80d11ed2a5161afa3c798c0acc5573bd72ae5ae Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Mon, 5 Sep 2022 06:32:53 +0200 Subject: [PATCH] MP4: Fix heap-buffer-overflow in mp4properties.cpp (#1058) --- taglib/mp4/mp4properties.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/taglib/mp4/mp4properties.cpp b/taglib/mp4/mp4properties.cpp index 391cc4c7..df628800 100644 --- a/taglib/mp4/mp4properties.cpp +++ b/taglib/mp4/mp4properties.cpp @@ -188,7 +188,7 @@ MP4::Properties::read(File *file, Atoms *atoms) file->seek(mdhd->offset); data = file->readBlock(mdhd->length); - const unsigned int version = data[8]; + const unsigned int version = data.at(8); long long unit; long long length; if(version == 1) { @@ -222,13 +222,13 @@ MP4::Properties::read(File *file, Atoms *atoms) d->channels = data.toShort(40U); d->bitsPerSample = data.toShort(42U); d->sampleRate = data.toUInt(46U); - if(data.containsAt("esds", 56) && data[64] == 0x03) { + if(data.containsAt("esds", 56) && data.at(64) == 0x03) { unsigned int pos = 65; if(data.containsAt("\x80\x80\x80", pos)) { pos += 3; } pos += 4; - if(data[pos] == 0x04) { + if(data.at(pos) == 0x04) { pos += 1; if(data.containsAt("\x80\x80\x80", pos)) { pos += 3;