be more accurate when checking chunk sizes

This commit is contained in:
Ahmet Inan 2025-07-22 14:28:44 +02:00
commit 90ee3c521d

2
wav.hh
View file

@ -92,7 +92,7 @@ public:
return;
int Subchunk2Size = readLE(4);
int overhead = bits_ == 32 ? 58 : 44;
if (Subchunk2Size + overhead > ChunkSize)
if (Subchunk2Size + overhead - 8 != ChunkSize)
return;
if (Subchunk1Size == 16)
frames_ = Subchunk2Size / (bytes * channels_);