From 95ab110cd9a6083a854e538211618b2733aba643 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Mon, 21 Oct 2019 13:15:46 -0700 Subject: [PATCH] Optimize intersects_array to fix fuzzer timeout. --- src/hb-ot-layout-gsubgpos.hh | 10 +++++----- ...minimized-hb-subset-fuzzer-5763024094232576 | Bin 0 -> 125681 bytes 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5763024094232576 diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 1380e5531..4f0e17b0c 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -712,11 +712,11 @@ static inline bool intersects_array (const hb_set_t *glyphs, intersects_func_t intersects_func, const void *intersects_data) { - return - + hb_iter (values, count) - | hb_map ([&] (const HBUINT16 &_) { return intersects_func (glyphs, _, intersects_data); }) - | hb_any - ; + for (const HBUINT16 &_ : + hb_iter (values, count)) + { + if (intersects_func (glyphs, _, intersects_data)) return true; + } + return false; } diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5763024094232576 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5763024094232576 new file mode 100644 index 0000000000000000000000000000000000000000..da1b718a5c7523ed822f9b00781b0e2b23827aec GIT binary patch literal 125681 zcmeI534ByVy6Eflme8F95)-!2qzMpq$WGYz9TH6M=}zyR1W0#c64HCR1B}R`q5(ui zMFkxY85Cp?6hYh&98nQ*+)z+qWDp^6LQY8EuR1}%W#09@cjwN`@2mcGol{j`)v5Z| z)?KF-!Vp3jSwu~fD<>9Df8E6E|p)O*Q2p^_A7`~T8gNaW>a20_Yj|f2T0au28 z9;aqP#z)N5ju07-)G8-dbtQ3NjELK8l{Qds6(|%1B!+|_xbc&wPL<7Hdg%msIDVV? z*W8JK9|A!_z(>mo5{lu&{ci_BgCyh;_2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