aboutsummaryrefslogtreecommitdiffstats
path: root/taglib/flac
diff options
context:
space:
mode:
authorbobsayshilol <bobsayshilol@live.co.uk>2021-04-24 15:56:52 +0100
committerUrs Fleisch <ufleisch@users.sourceforge.net>2021-05-02 12:14:27 +0200
commit3391bd80c423a024cd19af7db68bbc3f41dccbd9 (patch)
treed8ff2d658ab9b35e4e506a38a9f8991793e0dd9f /taglib/flac
parent1644c0dd87f40a2492bde4011fe72257fc72ee0e (diff)
FLAC: Validate the size of a read
Without this we can crash trying to dereference parts of `header`.
Diffstat (limited to 'taglib/flac')
-rw-r--r--taglib/flac/flacfile.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/taglib/flac/flacfile.cpp b/taglib/flac/flacfile.cpp
index ada215db..6ecd3bad 100644
--- a/taglib/flac/flacfile.cpp
+++ b/taglib/flac/flacfile.cpp
@@ -497,6 +497,11 @@ void FLAC::File::scan()
seek(nextBlockOffset);
const ByteVector header = readBlock(4);
+ if(header.size() != 4) {
+ debug("FLAC::File::scan() -- Failed to read a block header");
+ setValid(false);
+ return;
+ }
// Header format (from spec):
// <1> Last-metadata-block flag