Skip to content

Kernel: On net10.0, an empty content stream is written as FlateDecode with /Length 0 #640

Closed

Description

@Tim81
  • Input: a page with no content, saved with default settings.
  • Measured on a probe built from the test(kernel): pin the catalog bytes of Save and the signing path (part of #606) #626 branch (test/catalog-golden-hashes, branched from main bd85e70), Release, same document on two runtimes: on net10.0 (runtime 10.0.15) the page's content stream is /Filter /FlateDecode, /Length 0, and the stream body is empty. On net11.0 (runtime 11.0.0) the same stream is /Length 8 with the bytes 78 9C 03 00 00 00 00 01. An empty body is not a zlib stream (RFC 1950 needs a header and an Adler-32), so a strict reader of the net10.0 file has nothing to inflate. Every variant I dumped (plain, outline, tagged, PDF/A-2u, PDF/UA-1, form, linearized, object streams) has exactly one such stream, /Length 0 on net10.0 and /Length 8 on net11.0.
  • Cause by reading: PdfStream.cs:74-75 compresses through ZLibStream and does not special-case zero input. That net10.0's ZLibStream writes nothing when given no data is what the output above shows; the runtime source was not read.
  • qpdf --check (12.4.2) on the net10.0 file reports "No syntax or stream encoding errors found" and exits 0, so qpdf does not flag the empty FlateDecode body.
  • Consequence for reproducibility: the same document differs by runtime in bytes and in validity, which also bears on Layout: expose Timestamp and DocumentId on Document for reproducible output #597 and on the golden hashes in test(kernel): pin the catalog bytes of Save and the signing path (part of #606) #626.
  • API: PdfDocument.Save, PdfStream (a content stream with no operators).
  • Suggested milestone: v2.4 (writes a stream that is not valid zlib on the LTS target). Fix shape: when the uncompressed body is empty, write the 8-byte empty zlib stream explicitly, or write no /Filter.

From the v2.4 discoveries list in #613 (item 13).

Activity

  1. added
    bug
    on Nov 20, 2026
  2. added a commit that references this issue on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions