@@ -170,7 +170,7 @@ pub fn match_lookahead(
170
170
start_index : usize ,
171
171
end_index : & mut usize ,
172
172
) -> bool {
173
- let mut iter = skipping_iterator_t:: new ( ctx, start_index - 1 , true ) ;
173
+ let mut iter = skipping_iterator_t:: new ( ctx, start_index. saturating_sub ( 1 ) , true ) ;
174
174
iter. set_glyph_data ( 0 ) ;
175
175
iter. enable_matching ( match_func) ;
176
176
@@ -867,7 +867,9 @@ fn apply_lookup(
867
867
match_positions[ j] = ( match_positions[ j] as isize + delta) as _ ;
868
868
}
869
869
870
- backtrack_len + match_end - ctx. buffer . idx
870
+ backtrack_len
871
+ . saturating_add ( match_end)
872
+ . saturating_sub ( ctx. buffer . idx )
871
873
} ;
872
874
873
875
for record in lookups {
@@ -1316,7 +1318,9 @@ pub fn ligate_input(
1316
1318
if this_comp == 0 {
1317
1319
this_comp = last_num_comps;
1318
1320
}
1319
- let new_lig_comp = comps_so_far - last_num_comps + this_comp. min ( last_num_comps) ;
1321
+ let new_lig_comp = comps_so_far
1322
+ . saturating_add ( this_comp. min ( last_num_comps) )
1323
+ . saturating_sub ( last_num_comps) ;
1320
1324
_hb_glyph_info_set_lig_props_for_mark ( cur, lig_id, new_lig_comp) ;
1321
1325
}
1322
1326
buffer. next_glyph ( ) ;
@@ -1344,7 +1348,9 @@ pub fn ligate_input(
1344
1348
break ;
1345
1349
}
1346
1350
1347
- let new_lig_comp = comps_so_far - last_num_comps + this_comp. min ( last_num_comps) ;
1351
+ let new_lig_comp = comps_so_far
1352
+ . saturating_add ( this_comp. min ( last_num_comps) )
1353
+ . saturating_sub ( last_num_comps) ;
1348
1354
_hb_glyph_info_set_lig_props_for_mark ( info, lig_id, new_lig_comp)
1349
1355
}
1350
1356
}
0 commit comments