Corrupt and malformed test files for error handling, free and CC0
Most test files are meant to be read successfully. These are not, or not unambiguously.
Every file under edge/ is wrong on purpose, or ambiguous on purpose, in one declared way:
empty, cut short, malformed, carrying bytes that do not match the name and content type it
is served with, or valid as two formats at once so that nothing decides which it is.
Each is served as the type its extension claims, because that is the situation worth
testing. edge/png-with-pdf-extension.pdf arrives as application/pdf and is a PNG;
edge/pdf-truncated-60pct.pdf reads as a PDF until it stops mid-object. Sniffing the type
from the extension, or assuming a parser raises a tidy error, are mistakes these files find.
Each also says what is wrong with it: every row below carries a damage sentence, the
valid file to compare_with, and an outcome: must-fail when every conforming reader
must refuse it, may-recover when part of it still reads, varies when readers disagree.
Only must-fail means a reader that copes is wrong.
The two polyglots are edge/pdf-zip-polyglot.pdf, a PDF and a zip archive, and
edge/gif-zip-polyglot.gif, a GIF and a zip. That shape is also how malware travels, so
scanners and corporate proxies sometimes refuse a polyglot or strip the archive in transit:
if a download arrives short, check sha256sums.txt first.
Use them on upload forms, import pipelines, thumbnailers and archive extractors.
edge/zip-directory-traversal-name.zip holds an entry named ../evil.txt and tells you
whether yours writes outside the directory it was given. Related: PDF, ZIP.
| File | Size | Properties | Description |
|---|---|---|---|
csv-ragged-rows.csv
|
65 B | invalid-syntax, varies | A CSV whose rows carry different field counts: one short, one long.
Snippets
|
gif-zip-polyglot.gif
|
200 B | polyglot, varies | One file that is a valid GIF image and a valid zip archive at once: the archive is everything after the GIF trailer. Scanners and proxies sometimes refuse polyglots outright; see the notes on the page.
Snippets
|
jpg-truncated-50pct.jpg
|
7.5 KB (7,496 bytes) | truncated, may-recover | The first half of jpg/640x480.jpg: scan data ends with no end-of-image marker.
Snippets
|
json-bom.json
|
80 B | bom, varies | Valid JSON preceded by a UTF-8 byte-order mark, which RFC 8259 does not allow.
Snippets
|
json-trailing-comma.json
|
64 B | invalid-syntax, must-fail | JSON with a trailing comma in an array and an object: valid JavaScript, invalid JSON.
Snippets
|
mp4-truncated-50pct.mp4
|
987.3 KB (987,287 bytes) | truncated, may-recover | The first half of mp4/720p-5s.mp4: a partial media stream inside a box that claims more.
Snippets
|
pdf-truncated-60pct.pdf
|
2.6 KB (2,610 bytes) | truncated, may-recover | The first 60% of pdf/a4-3pages.pdf: the header reads, then the file stops mid-object.
Snippets
|
pdf-with-png-extension.png
|
1.8 KB (1,795 bytes) | mismatched-extension, varies | The bytes of pdf/a4-1page.pdf under a .png name, served as image/png.
Snippets
|
pdf-zip-polyglot.pdf
|
800 B | polyglot, varies | One file that is a valid PDF and a valid zip archive at once: a PDF reader shows a page, a zip reader extracts readme.txt. Scanners and proxies sometimes refuse polyglots outright; see the notes on the page.
Snippets
|
png-with-pdf-extension.pdf
|
1.4 KB (1,387 bytes) | mismatched-extension, varies | The bytes of png/100x100.png under a .pdf name, served as application/pdf.
Snippets
|
utf8-invalid-bytes.txt
|
143 B | invalid-encoding, may-recover | Text served as UTF-8 that contains byte sequences UTF-8 does not allow.
Snippets
|
xml-unclosed-tag.xml
|
122 B | invalid-syntax, must-fail | XML with an element that is never closed, so it is not well-formed.
Snippets
|
zero-byte.csv
|
0 B | zero-byte, must-fail | An empty file served as text/csv, with no header row.
Snippets
|
zero-byte.json
|
0 B | zero-byte, must-fail | An empty file served as application/json, where a parser expects at least a value.
Snippets
|
zero-byte.mp4
|
0 B | zero-byte, must-fail | An empty file served as video/mp4.
Snippets
|
zero-byte.pdf
|
0 B | zero-byte, must-fail | An empty file served as application/pdf.
Snippets
|
zero-byte.png
|
0 B | zero-byte, must-fail | An empty file served as image/png.
Snippets
|
zero-byte.txt
|
0 B | zero-byte, varies | An empty file served as text/plain.
Snippets
|
zero-byte.zip
|
0 B | zero-byte, must-fail | An empty file served as application/zip, with not even an end-of-central-directory record.
Snippets
|
zip-directory-traversal-name.zip
|
782 B | hostile-name, varies | A readable zip holding an entry named ../evil.txt. An extractor that joins entry names to a destination without sanitising them writes outside that directory.
Snippets
|
zip-truncated-50pct.zip
|
911 B | truncated, may-recover | The first half of zip/3-text-files.zip: local headers survive, the central directory does not.
Snippets
|
Every edge-case file in one command, each checked against its hash: npx loremfile get --format edge, or loremfile get --format edge after pip install loremfile.
Related formats
File names follow the naming grammar. Verify a download against sha256sums.txt.