mirror of
https://github.com/taglib/taglib.git
synced 2026-02-21 23:53:02 -05:00
wavpack: Fix infinite loop when reading broken files (#1304)
A crafted file can have blockSamples set to 0 and a blockSize so big that when adding 8 it overflows and offset is 0 so it goes back to the same position and loops forever
This commit is contained in:
@ -260,16 +260,16 @@ void WavPack::Properties::read(File *file, offset_t streamLength)
|
||||
const unsigned int flags = data.toUInt(24, false);
|
||||
unsigned int smplRate = sampleRates[(flags & SRATE_MASK) >> SRATE_LSB];
|
||||
|
||||
if(!blockSamples) { // ignore blocks with no samples
|
||||
offset += blockSize + 8;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(blockSize < 24 || blockSize > 1048576) {
|
||||
debug("WavPack::Properties::read() -- Invalid block header found.");
|
||||
break;
|
||||
}
|
||||
|
||||
if(!blockSamples) { // ignore blocks with no samples
|
||||
offset += blockSize + 8;
|
||||
continue;
|
||||
}
|
||||
|
||||
// For non-standard sample rates or DSD audio files, we must read and parse the block
|
||||
// to actually determine the sample rate.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user