Guard CFF2 BLEND operator against empty argument stack - #222
Open
scadastrangelove wants to merge 1 commit into
Open
Guard CFF2 BLEND operator against empty argument stack#222scadastrangelove wants to merge 1 commit into
scadastrangelove wants to merge 1 commit into
Conversation
VS_INDEX checks p.stack.len() != 1 before its pop; BLEND popped unconditionally to read its operand count, hitting the mandatory slice bounds check once len wraps to usize::MAX -- same root cause as harfbuzz#80 (fixed by f28f7a5), which only touched cff1.rs's seac path and left cff2.rs's BLEND operator unguarded. Discovered by the rust-in-peace security pipeline (https://github.com/scadastrangelove/rust-in-peace/).
This was referenced Jul 20, 2026
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.
Closes #218.
Mirrors the existing
VS_INDEXguard immediately above it (if p.stack.len() != 1 { return Err(...) }) and reuses the existingCFFError::InvalidArgumentsStackLengthvariant — no newerror type needed.
Testing
cargo test --all-features --release— 148/149 (the one failure,font_collection_num_fonts_overflow_2, is pre-existing and reproduces identically onunmodified
main, unrelated to this change).mainand returns a cleanNonewiththis patch.
Discovered by the rust-in-peace security pipeline.