Corrupted & Malformed PDF Files

The internet is a hostile environment. Users routinely upload PDFs that were interrupted during download, maliciously modified, or simply saved with the wrong extension. Your application must handle these gracefully without crashing the server or hanging in an infinite loop.

This suite of intentionally malformed files tests the absolute limits of your parser's resilience. From completely empty 0-byte files to severed Cross-Reference (xref) streams and invalid object references, these files guarantee you can catch exceptions cleanly.

0-Byte Empty File

spytm_0_byte.pdf0 Bytes

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.

Whitespace only streams

spytm_Whitespace_only_streams.pdf559 Bytes

A PDF where the content stream is populated entirely with null bytes and spaces. Tests buffering efficiency on empty data.

Invalid object references

spytm_Invalid_object_references.pdf701 Bytes

A PDF where the page tree points to a non-existent child object, ensuring parsers handle dangling pointers gracefully.

Duplicate object IDs

spytm_Duplicate_object_IDs.pdf728 Bytes

A PDF declaring the same structural Object ID twice, testing dictionary collision resolution.

Truncated

spytm_Truncated.pdf7.6 KB

A valid PDF that was sliced exactly in half. Simulates a severe network interruption during upload.

Missing EOF Marker

spytm_Missing_EOF.pdf15.2 KB

A PDF where the absolute final `%%EOF` marker has been deleted. Tests backward-scanning parser limits.

Wrong MIME type

spytm_Wrong_MIME_type.txt15.2 KB

A valid PDF file renamed with a `.txt` extension. Tests if your system relies on file extensions or reads the actual magic bytes.

Corrupted

spytm_Corrupted.pdf15.2 KB

A PDF where a block of internal bytes has been randomized. The trailer is intact, but the internal objects are destroyed.

Renamed extension

spytm_Renamed_extension.jpg15.2 KB

A valid PDF file renamed to `.jpg`. Tests if your image processors correctly reject non-image payloads.

Stream length mismatch

spytm_Stream_length_mismatch.pdf15.2 KB

A PDF where the `/Length` dictionary value does not match the actual byte length of the stream, testing dynamic stream-boundary detection.

Broken Cross-Reference Table

spytm_Broken_xref.pdf15.2 KB

A PDF where the Cross-Reference table byte offsets are intentionally shifted. Tests xref reconstruction algorithms.

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 `.pdf` is correctly rejected.
  • Ensuring network interruption handling correctly identifies truncated binary payloads.

Related Test Files

S
SPYTM

Experience the pinnacle of digital communication. The ultimate ultra-premium platform designed for those who demand excellence.

© 2026 SPYTM. All rights reserved.