From caf705958e9d664811a0ec5a951d92c0140fddae Mon Sep 17 00:00:00 2001 From: "Stephen F. Booth" Date: Fri, 29 Nov 2013 08:24:22 -0500 Subject: [PATCH] Validate the tag's version of file length against the actual length --- taglib/dsf/dsffile.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/taglib/dsf/dsffile.cpp b/taglib/dsf/dsffile.cpp index 860096a3..2000774e 100644 --- a/taglib/dsf/dsffile.cpp +++ b/taglib/dsf/dsffile.cpp @@ -168,6 +168,14 @@ void DSF::File::read(bool readProperties, AudioProperties::ReadStyle propertiesS } d->fileSize = readBlock(8).toInt64LE(0); + + // File is malformed or corrupted + if(d->fileSize != length()) { + debug("DSF::File::read() -- File is corrupted."); + setValid(false); + return; + } + d->metadataOffset = readBlock(8).toInt64LE(0); // File is malformed or corrupted