Repository navigation
pdf: bound CFF endchar seac recursion so a cyclic font can't overflow the stack - #1477
Merged
bflatastic merged 1 commit intoOct 16, 2026
Merged
Conversation
Member
|
Merged, thank you @midasmatterhorn! It landed on |
Contributor
Author
|
Thanks! |
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.
Importing a PDF or AI file that embeds a name-keyed CFF font whose accented glyph is an
endcharseac pointing back at itself (directly or through a short cycle) recurses inCff::outlineuntil the stack overflows and the process aborts — a stack overflow is not catchable by the app'scatch_unwindguard, so the whole app dies. The seac components are resolved withfind(code).and_then(|g| self.outline(g))and there is no depth limit, while the Type 1 interpreter one file over already bounds the same nesting withdepth < 2.This mirrors that guard:
outlinestays the entry point and routes the components through a privateoutline_depth(gid, depth), so a cyclic font is cut off instead of crashing. The regression test builds aw adx ady 65 65 endcharglyph that seacs onto itself using the existingwrite_test_cfffixture and asserts the outline comes back empty; before the fix the test process overflowed the stack (SIGABRT), after it passes.Partially addresses #1446 (finding 1, CFF seac recursion). Targeted tests green locally;
cargo xtask cileft to the project runners.