Test files › Audio and video › declared-length-mismatch.wav
Corrupt WAV file (declared length mismatch)
Valid WAV whose data chunk header declares ten times more bytes than the file actually contains.
↓ Download declared-length-mismatch.wav| Filename | declared-length-mismatch.wav |
| Format | WAV |
| Size | 172 KB (176,444 bytes) |
| MIME type | audio/wav |
| SHA-256 | fa849fa10674fce6a798353aad7913789f3dd054fa4b677ad368ee8e1e21d790 |
What this file catchesDecoders that trust the declared chunk length and either read past the buffer or hang waiting for data that never arrives. A robust decoder clamps to the actual file size.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
Compare what the header declares with what the file holds, and refuse a header that is itself cut short.
import wave
try:
with wave.open("declared-length-mismatch.wav") as w:
declared = w.getnframes()
frame_size = w.getsampwidth() * w.getnchannels()
actual = len(w.readframes(declared)) // frame_size
note = "truncated or lying header" if actual < declared else "ok"
print(f"header says {declared} frames, file holds {actual}: {note}")
except (wave.Error, EOFError) as e:
print("rejected:", str(e) or "the header is cut short")Run against this file, it prints: header says 882000 frames, file holds 88200: truncated or lying header
Related guides and tools
Download & verify
curl -fsSL -o "declared-length-mismatch.wav" "https://files.hexaqa.com/audio/declared-length-mismatch.wav"
curl -fsSL "https://files.hexaqa.com/audio/declared-length-mismatch.wav" | sha256sum
# expect: fa849fa10674fce6a798353aad7913789f3dd054fa4b677ad368ee8e1e21d790