[SingleSubstFormat1] Help avoid timeouts in closure() some more

For https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49712
pull/3773/head
Behdad Esfahbod 2 years ago
parent ba9b20534c
commit 6549aec89d
  1. 7
      src/OT/Layout/GSUB/SingleSubstFormat1.hh

@ -42,6 +42,11 @@ struct SingleSubstFormat1_3
hb_codepoint_t d = deltaGlyphID;
hb_codepoint_t mask = get_mask ();
/* Help fuzzer avoid this function as much. */
unsigned pop = (this+coverage).get_population ();
if (pop >= mask)
return;
hb_set_t intersection;
(this+coverage).intersect_set (c->parent_active_glyphs (), intersection);
@ -52,7 +57,7 @@ struct SingleSubstFormat1_3
hb_codepoint_t max_before = intersection.get_max ();
hb_codepoint_t min_after = (min_before + d) & mask;
hb_codepoint_t max_after = (max_before + d) & mask;
if ((this+coverage).get_population () >= max_before - min_before &&
if (pop >= max_before - min_before &&
((min_before <= min_after && min_after <= max_before) ||
(min_before <= max_after && max_after <= max_before)))
return;

Loading…
Cancel
Save