Skip to content

fix(pdf): validate incremental writes and restore input state - #1163

Merged
andiwand merged 2 commits into
mainfrom
review/145-pdf-writer-validation
Oct 6, 2026
Merged

andiwand merged 2 commits into
mainfrom
review/145-pdf-writer-validation

Conversation

@andiwand

@andiwand andiwand commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

PDF incremental writes could silently succeed after an append failure and leave the parser at EOF after a failed copy. Restore its position on success and failure, check output errors and file-size limits, and reject reserved, oversized or conflicting object references before staging them. Both stream and ordinary objects share the reference checks.

Validation: both regression tests fail on the parent; 83 writer, annotation and parser tests pass after the fix. clang-tidy and Android, WebAssembly and iOS object builds pass. Adds two focused tests, including retry after failure and object-ID exhaustion.

@andiwand
andiwand force-pushed the review/144-pdf-color-ranges branch from 7ddc641 to 32d0291 Compare October 6, 2026 18:57
Base automatically changed from review/144-pdf-color-ranges to main October 6, 2026 18:58
andiwand and others added 2 commits October 6, 2026 20:58
InputPosition kept a reference member. Members here are pointers, so it
holds the stream through one. The bare position() call before the copy
only checks that the finished file fits the 32-bit xref offsets, and a
comment says so.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxyTMutqSUJRGfxA8CyzMc
@andiwand
andiwand force-pushed the review/145-pdf-writer-validation branch from 8189159 to 28db6be Compare October 6, 2026 19:01
@andiwand
andiwand merged commit 566ee1f into main Oct 6, 2026
21 of 23 checks passed
@andiwand
andiwand deleted the review/145-pdf-writer-validation branch October 6, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant