Skip to content

Commit

Permalink
Avoid possible overflow in OT layout code when adding delta (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens authored Nov 9, 2024
1 parent 34c0701 commit f49d8f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hb/ot_layout_gsubgpos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ fn apply_lookup(
//
// It should be possible to construct tests for both of these cases.

end = (end as isize + delta) as _;
end = end.saturating_add_signed(delta);
if end < match_positions[idx] {
// End might end up being smaller than match_positions[idx] if the recursed
// lookup ended up removing many items.
Expand Down

0 comments on commit f49d8f3

Please sign in to comment.