[Coverage] Avoid timeout on broken ranges

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53929
This commit is contained in:
Behdad Esfahbod 2022-12-02 12:33:24 -07:00
parent c947652768
commit 2a7a1d5a73
1 changed files with 6 additions and 1 deletions

View File

@ -142,9 +142,14 @@ struct CoverageFormat2_4
hb_requires (hb_is_sink_of (IterableOut, hb_codepoint_t))>
void intersect_set (const hb_set_t &glyphs, IterableOut&& intersect_glyphs) const
{
/* Break out of loop for overlapping, broken, tables,
* to avoid fuzzer timouts. */
hb_codepoint_t last = 0;
for (const auto& range : rangeRecord)
{
hb_codepoint_t last = range.last;
if (unlikely (range.first < last))
break;
last = range.last;
for (hb_codepoint_t g = range.first - 1;
glyphs.next (&g) && g <= last;)
intersect_glyphs << g;