Broken, corrupted and edge-case filename test files for QA
Happy-path tests only prove your application works when users upload well-formed files. Use this curated negative-test suite—zero-byte files, truncated PDFs and JPEGs, corrupted ZIP CRCs, spoofed extensions, malformed UTF-8 sequences, and edge-case filenames—to verify that your parser fails gracefully.
1. Malformed, spoofed-extension and encoding-error fixtures (Direct static downloads)
| Fixture file | Exact size | Intentional defect & what it tests | SHA-256 checksum | Download |
|---|---|---|---|---|
| wrong-extension-png-as-jpg.jpg | 730 bytes | Valid PNG binary bytes (89 50 4E 47) named with .jpg extension to test magic-byte vs. extension checks | 3b3a1de375821346ccd541021c5eac8903d0944dfff4582631950b1c4a183585 |
Download |
| wrong-mime-html-in-csv.csv | 112 bytes | HTML markup saved with a .csv extension to test X-Content-Type-Options: nosniff and upload content inspection | 30aa25380acdcaec1c4f42025d8b3f711eb30c6f9464fc27a6b255a649008a85 |
Download |
| malformed-utf8-sequences.txt | 80 bytes | Text file containing invalid UTF-8 sequences (overlong 0xC0 0xAF, lone surrogates, 0xFF 0xFE) for decoder testing | e9ad53d75dc6b4d397813042fe8bbb051e3352813a3535f7797ea4c9a2a12adb |
Download |
| unclosed-quotes-malformed.csv | 111 bytes | Malformed CSV with unescaped/unclosed double quote on row 2 for RFC 4180 error-recovery testing | 6a6995620bce8a3eaef0e1cd94e8f247a512a7ea49309c9509e6c12df14c0dd0 |
Download |
| truncated-payload.json | 108 bytes | Truncated JSON document cut off mid-string to test parser syntax error handling | f19171ede76b8d09feae3887551a073cd12e3fea67efd2302d5b9ef7f80fea23 |
Download |
| zero-byte-empty.bin | 0 bytes | 0-byte empty binary file for minimum-length and empty-stream boundary tests | e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
Download |
2. Corrupted containers and awkward filenames in our curated library
In addition to the direct fixtures above, our Curated Sample Files collection includes dedicated pages with hex dumps and failure analysis for container corruption and awkward OS filenames:
| Curated fixture | Size | Failure mode tested | Open fixture page |
|---|---|---|---|
| Empty file (0 bytes) | 0 bytes | Minimum file-size validation, division-by-zero in progress bars, and empty stream handling | empty-file.txt |
| Truncated PDF file | 7,713 bytes | Cut off at 60% of length (missing cross-reference table and %%EOF trailer) | sample-pdf-corrupted.pdf |
| Password-protected PDF | 2,331 bytes | Encrypted PDF (password: sample) to test how previewers handle locked documents | Password PDF |
| Truncated JPEG image | 18,874 bytes | Cut off mid-scan before the FF D9 End-of-Image marker to test image decoder resilience | sample-jpg-truncated.jpg |
| Corrupted Word DOCX | 3,072 bytes | Truncated ZIP container missing its central directory record | sample-docx-corrupted.docx |
| Corrupted ZIP (CRC mismatch) | 342 bytes | Valid ZIP central directory structure, but payload bytes altered so CRC-32 verification fails | sample-zip-corrupted.zip |
| Unicode multi-script filename | 189 bytes | sample-ünïcödé-文件-имя.txt (Latin, CJK, and Cyrillic NFC/NFD normalization in Content-Disposition) | Unicode filename |
| 120-character filename | 165 bytes | Tests UI table truncation, S3/database VARCHAR(100) column overflow, and path length limits | Long filename |
| Filename with spaces | 161 bytes | sample file name with spaces.txt to catch unquoted shell arguments and URL encoding bugs | Spaces filename |
| Filename without extension | 162 bytes | sample-file-without-extension to test fallback magic-byte sniffing when path.extname() is empty | No extension |
3. Testing Windows reserved device filenames (CON, PRN, AUX, NUL, COM1, LPT1)
On Microsoft Windows (Win32 namespace), the filenames CON, PRN, AUX, NUL, COM1–COM9, and LPT1–LPT9 (with or without an extension, such as CON.txt or NUL.pdf) are reserved MS-DOS device names. Because static web servers and zip extractors on Windows cannot write a physical file named CON.txt to a standard NTFS folder without triggering an OS device error, we recommend testing reserved-name sanitization in your automated test suite by constructing a File object in memory in Playwright or browser JavaScript:
// Safe in-memory test for Windows reserved filenames, trailing dots, and path traversal
const reservedNames = ['CON.txt', 'PRN.pdf', 'AUX.csv', 'NUL.json', 'COM1.log', '../traversal.txt', 'trailing-dot.txt.'];
for (const badName of reservedNames) {
const file = new File(['test payload'], badName, { type: 'text/plain' });
// Pass `file` to your upload validator and assert that it sanitizes or rejects `badName`
}For a full walkthrough on writing negative upload tests, read How to test corrupted and unreadable files.
Frequently asked questions
- Are these broken files safe to download on my workstation?
- Yes. Every file in the Broken-File QA Test Set is completely inert data (truncated documents, mismatched headers, or invalid UTF-8 byte sequences) containing zero executable code or scripts.
- What should a well-designed upload endpoint return when given a corrupted or wrong-extension file?
- It should return an HTTP 400 Bad Request or 422 Unprocessable Entity response with a specific, user-safe validation message (see /mock-data/errors-400.json for an example error schema) rather than throwing an unhandled 500 Internal Server Error.