Test files › Archives › corrupt-central-directory.zip
Corrupt ZIP (broken central directory)
Valid local file headers, but the central directory signature is overwritten with garbage.
↓ Download corrupt-central-directory.zip| Filename | corrupt-central-directory.zip |
| Format | ZIP |
| Size | 219 bytes (219 bytes) |
| MIME type | application/zip |
| SHA-256 | d1194edeac6e322b76436927038138a9dc8325a93fc5daed8e399df8b68ed7d5 |
What this file catchesReaders that trust the central directory blindly and crash, versus tolerant ones that can recover entries by scanning local headers.
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
Open it inside a try block and report the failure to the user, instead of letting a background job die on it later.
import zipfile
try:
with zipfile.ZipFile("corrupt-central-directory.zip") as z:
bad = z.testzip() # reads every entry and checks its CRC
print(f"corrupt entry: {bad}" if bad else "ok")
except zipfile.BadZipFile as e:
print("rejected:", e)Run against this file, it prints: rejected: Bad magic number for central directory
Related guides and tools
Download & verify
curl -fsSL -o "corrupt-central-directory.zip" "https://files.hexaqa.com/archive/corrupt-central-directory.zip"
curl -fsSL "https://files.hexaqa.com/archive/corrupt-central-directory.zip" | sha256sum
# expect: d1194edeac6e322b76436927038138a9dc8325a93fc5daed8e399df8b68ed7d5