Corrupted DOCX Files
The internet is a hostile environment. Users will routinely upload DOCX files that were interrupted during download, maliciously modified, or simply saved with the wrong extension. Your application must handle these gracefully without crashing the server.
This suite of intentionally malformed files tests the absolute limits of your parser's resilience. From completely empty 0-byte files to severed ZIP streams and missing OpenXML manifests, these files guarantee you can catch exceptions cleanly.
0-Byte Empty File
An entirely empty file containing exactly 0 bytes. Excellent for testing if your parser throws an immediate, clean error or crashes with a NullPointer exception.
Truncated ZIP Stream
A valid DOCX file that was sliced exactly in half. Simulates a network interruption during upload.
Missing [Content_Types].xml
A valid ZIP archive containing Word XML, but the critical `[Content_Types].xml` manifest has been deleted. Compliant parsers must reject this immediately.
Spoofed Extension (TXT)
A valid DOCX file that has been renamed with a `.txt` extension. Tests if your system relies on file extensions or reads the actual magic bytes.
Corrupted ZIP Stream
A DOCX file where a block of internal bytes has been randomized. The ZIP container is intact, but the internal XML is destroyed.
Spoofed Extension (JPG)
A valid DOCX file renamed to `.jpg`. Tests if your image processors correctly reject non-image payloads.
Frequently Asked Questions
Use Cases
- Testing parser resilience to ensure malformed files trigger handled exceptions rather than fatal segmentation faults.
- Validating magic-byte (MIME type) detection logic to ensure a `.jpg` renamed to `.docx` is correctly rejected.
- Ensuring network interruption handling correctly identifies truncated ZIP payloads.