Repository navigation
fix: validate PDF object tokens and references - #1158
Merged
Merged
Conversation
andiwand
force-pushed
the
review/139-png-test-helpers
branch
from
October 6, 2026 18:21
d17013e to
9a676e4
Compare
A repeated key threw, which made the whole dictionary unreadable. Pages and resources with a repeated /Type or /MediaBox occur in the wild, and Ghostscript renders them with the first value. The parser keeps the first value again, as it did before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MxyTMutqSUJRGfxA8CyzMc
andiwand
force-pushed
the
review/140-pdf-object-tokens
branch
from
October 6, 2026 18:34
adf0a7b to
566cc05
Compare
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.
🤖 Generated with Claude Code
PDF object parsing accepted keyword prefixes and wrong-case keywords, truncated names containing regular non-ASCII bytes, and accepted negative or oversized reference indices.
Require complete case-sensitive keywords, preserve regular name bytes, reject null name escapes, and validate reference indices consistently in arrays, dictionary values and explicit references. A repeated dictionary key keeps its first value, as Ghostscript reads it. Shorten the parser contracts. These rules follow ISO 32000-1 §§7.2.2, 7.3.5, 7.3.7, 7.3.10 and 7.5.4; object IDs retain the file parser's 32-bit implementation limit.
Validation: four focused regressions expose 19 failures on the parent implementation. All 117 targeted parser/CMap/writer tests and 50 PDF corpus HTML-generation tests pass. LLVM 22 clang-tidy passes, as do object builds with NDK 28.1, emsdk 3.1.73 and the iOS 15 deployment target.