Skip to content

Commit

Permalink
[skrifa] tthint: fix overflow in flip region instruction
Browse files Browse the repository at this point in the history
first commit has failing test

ref https://issues.oss-fuzz.com/issues/377736138
  • Loading branch information
dfrg committed Dec 10, 2024
1 parent e7161e7 commit d196410
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions skrifa/src/outline/glyf/hint/engine/outline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,18 @@ mod tests {
assert!(engine.graphics.did_iup_y);
}

// Add with overflow caught by fuzzer:
// https://issues.oss-fuzz.com/issues/377736138
#[test]
fn flip_region_avoid_overflow() {
let mut mock = MockEngine::new();
let mut engine = mock.engine();
engine.value_stack.push(1).unwrap();
engine.value_stack.push(-1).unwrap();
// Just don't panic
let _ = engine.set_on_curve_for_range(true);
}

fn set_test_vectors(engine: &mut Engine) {
let v = math::normalize14(100, 50);
engine.graphics.proj_vector = v;
Expand Down

0 comments on commit d196410

Please sign in to comment.