Repository navigation
Validate the output with independent readers and the input with fuzzing and corpora - #32
Open
CastleSoft wants to merge 2 commits into
Open
CastleSoft wants to merge 2 commits into
CastleSoft wants to merge 2 commits into
Conversation
…ng and corpora A writer that only reads its own output back cannot see the mistakes it shares with itself. validation.yml now puts the example output and a validation corpus (written by tools/SharpCorePDF.Validation, with a manifest of the text, passwords, permissions, revisions and signature coverage each document must have) through qpdf, pypdf, pdfminer.six, MuPDF, pdf.js, fontTools, OTS, PDFium and pyHanko, checks the incremental-update invariants, and replays the fuzz seeds and four hostile documents. robustness.yml runs libFuzzer over the parser and the DCT, CCITT, LZW, Flate and RunLength decoders, reads the veraPDF and pdf.js corpora one process per file, and judges the PDF/A writer with veraPDF over the veraPDF corpus. compliance.yml cross-validates PDF/A-4. The checks found defects that are not fixed here. Each is pinned by a skipped test (PdfSignatureAttackTests, PdfIncrementalInvariantTests) or a strict --known-defect flag that fails the run once the defect is fixed, and docs/validation.md lists them with their evidence. No shipped package changes. The constitution's statement that no Python validator runs in CI is corrected as a proposed PATCH amendment (2.0.1) for the maintainer to ratify. Local AI assistant state (.claude/, CLAUDE.local.md) is ignored.
pdf.js 6 has no PDFDocumentProxy.destroy(), so the encryption check's pdf.js leg reported every document as unopenable: the call threw inside the try that was meant to catch a wrong password. The loading task owns the document and destroying it releases both. The fix was made before the previous commit but an editor saved a stale copy of the file over it.
This was referenced Nov 16, 2026
Author
|
Maintainer notes for the six pull requests (#32 to #37), which are stacked and should merge in this order: #32, #33, #34, #35, #36, #37. Each contains the commits of the ones before it until they merge.
Six items from the validation review are in progress across these; #37 carries the last of them, and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Adds twelve independent validation checks, so readers that share no code with this library judge what it
writes, and fuzzers and public corpora test what it reads.
validation.yml(every push and pull request)puts the example output and a new validation corpus through qpdf, pypdf, pdfminer.six, MuPDF, pdf.js,
fontTools, OTS, PDFium and pyHanko, checks the incremental-update invariants, and replays the fuzz seeds and
four hostile documents.
robustness.yml(weekly) runs libFuzzer over the parser and five decoders, readsthe veraPDF and pdf.js corpora one process per file, and judges the PDF/A writer with veraPDF.
compliance.ymlnow cross-validates PDF/A-4. No shipped package changes.docs/validation.mdis the record.Why, and what is wrong today
A writer that only reads its own output back cannot see the mistakes it shares with itself. The new checks
found defects that this pull request records but does not fix. Fixes follow in separate pull requests:
/ByteRangegap that holds more than/Contents(signature wrapping)/Lengthrecursion (uncatchable stackoverflow), allocations sized by object-stream
/N, unchecked JPEG Huffman selectors/ID[0]and append a renumbered copy of the whole document, which alsorewrites the signature dictionary after signing
/MediaBox; an empty-name dictionary key, an upside-down glyph box and anout-of-range date offset each fault real pdf.js-corpus files
The test that fails without this change
Each defect is pinned so CI stays green while it stands and goes red once it is fixed, until its pin is removed:
PdfSignatureAttackTests.Does_not_report_a_gap_that_holds_more_than_the_signature_value_as_covering_the_documentand
PdfIncrementalInvariantTests.Keeps_the_first_identifier_element_across_an_incremental_update.Both are skipped with the defect named; with the skip removed, each fails (checked locally).
--known-defect/--knownflags invalidation.ymlandrobustness.yml; a listed defect thatstops reproducing fails the run.
revision-readability and
/Sizeinvariants, and the writer-side gap check.Checklist
dotnet build .\SharpCorePDF.slnx -c Releaseis clean on both legs, with zero warningsPublicAPI.Shipped.txt/PublicAPI.Unshipped.txt: the surface is unchangedCHANGELOG.mdhas an entry under[Unreleased]docs/README.md, newdocs/validation.mdAnything else a reviewer should know
amendment 2.0.1 (fact only, no rule changes). It needs your ratification; drop that file if you
would rather amend separately.
contributor's choice, on the basis that the fixes follow immediately.
continue-on-error) and the judged PDF/Apre-flight. They could not run locally (no Docker daemon, no Java); each workflow says what to switch
on once the baseline exists.
every check in
validation.ymlpasses with its known-defect flags; the veraPDF corpus (1,471 files)reads cleanly; the pdf.js corpus (987 files) shows exactly the six listed faults.
review/validation-checks-2026-11-16on the fork marks this commit for sign-off. Itis not a release tag and does not match
v*.