FLAC: Validate the size of a read

Without this we can crash trying to dereference parts of `header`.
This commit is contained in:
bobsayshilol 2021-04-24 15:56:52 +01:00 committed by Urs Fleisch
parent 1644c0dd87
commit 3391bd80c4

View File

@ -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