diff options
author | bobsayshilol <bobsayshilol@live.co.uk> | 2021-04-24 15:56:52 +0100 |
---|---|---|
committer | Urs Fleisch <ufleisch@users.sourceforge.net> | 2021-05-02 12:14:27 +0200 |
commit | 3391bd80c423a024cd19af7db68bbc3f41dccbd9 (patch) | |
tree | d8ff2d658ab9b35e4e506a38a9f8991793e0dd9f /taglib/flac | |
parent | 1644c0dd87f40a2492bde4011fe72257fc72ee0e (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.cpp | 5 |
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 |