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

For https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49712
This commit is contained in:
Behdad Esfahbod 2022-08-01 13:11:14 -06:00
parent ba9b20534c
commit 6549aec89d
1 changed files with 6 additions and 1 deletions

View File

@ -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;