Repository navigation
fix: validate PDF color-space recursion and dimensions - #1150
Merged
Merged
Conversation
andiwand
force-pushed
the
review/131-formatting-scripts
branch
from
October 6, 2026 17:02
f9f2f49 to
71a68f5
Compare
…ette An ICCBased space whose Alternate has another component count, or does not parse, now drops the alternate and uses the device space N names, where it rejected the whole space. An Indexed palette shorter than HiVal asks for keeps its entries and reads the missing bytes as 0, as before. A rejected space made scn read an Indexed colour as a grey index, so the valid entries showed wrong colours too. 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/132-pdf-color-validation
branch
from
October 6, 2026 17:24
c17a83d to
0df3144
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
Recursive PDF color-space arrays and resource aliases could exhaust the stack. ICC component counts were narrowed without validation, and Indexed palette values were rounded before clipping. The shared parser now carries a 64-level limit through named resolution, checks ICC counts, validates the palette range, and rejects missing bases. An ICC alternate with another component count is dropped for the device space
Nnames, and a short palette reads its missing bytes as 0, so a usable space is never rejected for these. Finite palette indices clip before conversion.Separation and DeviceN share their common parse path; DeviceN requires nonempty colorant names. Uncolored patterns inherit the base component count. Validation follows ISO 32000-1 §§8.6.5.5 and 8.6.6.
Validation: parent fails the large-index and malformed-definition regressions; 176 focused color, parser, image, shading and extraction tests pass. All 50 PDF corpus metadata/HTML-generation cases pass (no visual comparison). LLVM 22 clang-tidy passes for the three changed implementation files; the color parser compiles to objects for NDK 28.1, emsdk 3.1.73 and iOS 15.