Skip to content

Commit

Permalink
[read-fonts] var: fix overflow in packed point numbers
Browse files Browse the repository at this point in the history
first commit contains failing test

ref https://issues.oss-fuzz.com/issues/378159154
  • Loading branch information
dfrg committed Dec 10, 2024
1 parent e7161e7 commit b7023b2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions read-fonts/src/tables/variations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1491,4 +1491,15 @@ mod tests {
let expected_len = 2 * row_len;
assert_eq!(ivs.delta_sets().len(), expected_len);
}

// Add with overflow when accumulating packed point numbers
// https://issues.oss-fuzz.com/issues/378159154
#[test]
fn packed_point_numbers_avoid_overflow() {
// Lots of 1 bits triggers the behavior quite nicely
let buf = vec![0xFF; 0xFFFF];
let iter = PackedPointNumbersIter::new(0xFFFF, FontData::new(&buf).cursor());
// Don't panic!
let _ = iter.count();
}
}

0 comments on commit b7023b2

Please sign in to comment.