[SingleSubstFormat1] Help avoid timeouts in closure() some more
For https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49712
diff --git a/src/OT/Layout/GSUB/SingleSubstFormat1.hh b/src/OT/Layout/GSUB/SingleSubstFormat1.hh
index 4b17243..13665d7 100644
--- a/src/OT/Layout/GSUB/SingleSubstFormat1.hh
+++ b/src/OT/Layout/GSUB/SingleSubstFormat1.hh
@@ -42,6 +42,11 @@
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 @@
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;