Repository navigation
fix: bound JBIG2 arithmetic and symbol decoding - #1159
Merged
Merged
Conversation
andiwand
force-pushed
the
review/140-pdf-object-tokens
branch
from
October 6, 2026 18:34
adf0a7b to
566cc05
Compare
decode_symbol_dictionary wrote the stream's remaining symbol pixels through a reference. It now takes the budget by value and returns the pixels its new symbols use next to the exported symbols, and the caller subtracts them. 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/141-jbig2-bounds
branch
from
October 6, 2026 18:41
cb86575 to
b03c16a
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
Malformed JBIG2 data could overflow arithmetic integer decoding and region placement, allocate excessive symbol tables, or keep symbol loops running without progress. Intermediate regions were also painted onto the page even though their use is unsupported.
Check integer and symbol bounds, use wider placement arithmetic, clip before composition, cap cumulative symbol pixels, and reject inconsistent exports and nonprogressing height classes. Unsupported intermediate regions now fail the image. Limits are documented in the PDF module instructions.
Validation: the parent fails both focused regression cases; UBSan independently reproduces the arithmetic and placement overflows. All 55 JBIG2/image/filter tests and 50 PDF corpus HTML-generation tests pass. ASan/UBSan pass placement checks and two million deterministic arithmetic decoding trials. LLVM 22 clang-tidy and object builds for NDK 28.1, emsdk 3.1.73 and iOS 15 pass.