# Corrupt and malformed test files for error handling, free and CC0

21 edge-case test files from 0 B to 987.3 KB. Direct URLs, a SHA-256 for each and CC0, so curl and CI can fetch them with no signup and no keys.

The page: <https://loremfile.dev/edge>.

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](https://loremfile.dev/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](https://loremfile.dev/pdf), [ZIP](https://loremfile.dev/zip).

## Files

| Path | Size | MIME | Properties |
|---|---|---|---|
| [`edge/csv-ragged-rows.csv`](https://loremfile.dev/edge/csv-ragged-rows.csv) | 65 B | `text/csv; charset=utf-8` | varies |
| [`edge/gif-zip-polyglot.gif`](https://loremfile.dev/edge/gif-zip-polyglot.gif) | 200 B | `image/gif` | varies |
| [`edge/jpg-truncated-50pct.jpg`](https://loremfile.dev/edge/jpg-truncated-50pct.jpg) | 7.5 KB (7,496 bytes) | `image/jpeg` | may-recover |
| [`edge/json-bom.json`](https://loremfile.dev/edge/json-bom.json) | 80 B | `application/json; charset=utf-8` | varies |
| [`edge/json-trailing-comma.json`](https://loremfile.dev/edge/json-trailing-comma.json) | 64 B | `application/json; charset=utf-8` | must-fail |
| [`edge/mp4-truncated-50pct.mp4`](https://loremfile.dev/edge/mp4-truncated-50pct.mp4) | 987.3 KB (987,287 bytes) | `video/mp4` | may-recover |
| [`edge/pdf-truncated-60pct.pdf`](https://loremfile.dev/edge/pdf-truncated-60pct.pdf) | 2.6 KB (2,610 bytes) | `application/pdf` | may-recover |
| [`edge/pdf-with-png-extension.png`](https://loremfile.dev/edge/pdf-with-png-extension.png) | 1.8 KB (1,795 bytes) | `image/png` | varies |
| [`edge/pdf-zip-polyglot.pdf`](https://loremfile.dev/edge/pdf-zip-polyglot.pdf) | 800 B | `application/pdf` | varies |
| [`edge/png-with-pdf-extension.pdf`](https://loremfile.dev/edge/png-with-pdf-extension.pdf) | 1.4 KB (1,387 bytes) | `application/pdf` | varies |
| [`edge/utf8-invalid-bytes.txt`](https://loremfile.dev/edge/utf8-invalid-bytes.txt) | 143 B | `text/plain; charset=utf-8` | may-recover |
| [`edge/xml-unclosed-tag.xml`](https://loremfile.dev/edge/xml-unclosed-tag.xml) | 122 B | `application/xml; charset=utf-8` | must-fail |
| [`edge/zero-byte.csv`](https://loremfile.dev/edge/zero-byte.csv) | 0 B | `text/csv; charset=utf-8` | must-fail |
| [`edge/zero-byte.json`](https://loremfile.dev/edge/zero-byte.json) | 0 B | `application/json; charset=utf-8` | must-fail |
| [`edge/zero-byte.mp4`](https://loremfile.dev/edge/zero-byte.mp4) | 0 B | `video/mp4` | must-fail |
| [`edge/zero-byte.pdf`](https://loremfile.dev/edge/zero-byte.pdf) | 0 B | `application/pdf` | must-fail |
| [`edge/zero-byte.png`](https://loremfile.dev/edge/zero-byte.png) | 0 B | `image/png` | must-fail |
| [`edge/zero-byte.txt`](https://loremfile.dev/edge/zero-byte.txt) | 0 B | `text/plain; charset=utf-8` | varies |
| [`edge/zero-byte.zip`](https://loremfile.dev/edge/zero-byte.zip) | 0 B | `application/zip` | must-fail |
| [`edge/zip-directory-traversal-name.zip`](https://loremfile.dev/edge/zip-directory-traversal-name.zip) | 782 B | `application/zip` | varies |
| [`edge/zip-truncated-50pct.zip`](https://loremfile.dev/edge/zip-truncated-50pct.zip) | 911 B | `application/zip` | may-recover |

The same list as JSON: <https://loremfile.dev/edge/index.json>.
