diff --git a/src/OT/Color/COLR/COLR.hh b/src/OT/Color/COLR/COLR.hh index 2de00072a..aacd76bb1 100644 --- a/src/OT/Color/COLR/COLR.hh +++ b/src/OT/Color/COLR/COLR.hh @@ -238,6 +238,9 @@ struct hb_colrv1_depend_context_t : if (unlikely (nesting_level_left == 0)) return hb_empty_t (); + if (paint_visited (&obj)) + return hb_empty_t (); + nesting_level_left--; obj.dependv1 (this); nesting_level_left++; @@ -245,12 +248,25 @@ struct hb_colrv1_depend_context_t : } static return_t default_return_value () { return hb_empty_t (); } + bool paint_visited (const void *paint) + { + hb_codepoint_t delta = (hb_codepoint_t) ((uintptr_t) paint - (uintptr_t) colr); + if (visited_paint.in_error() || visited_paint.has (delta)) + return true; + + visited_paint.add (delta); + if (unlikely (visited_paint.in_error ())) + depend_data->fail (); + return false; + } + const COLR* get_colr_table () const { return colr; } public: const COLR *colr; hb_depend_data_builder_t *depend_data; + hb_set_t visited_paint; unsigned nesting_level_left; hb_codepoint_t source_gid; @@ -2365,6 +2381,7 @@ struct COLR for (const BaseGlyphPaintRecord &baseglyph_paintrecord: baseglyph_paintrecords.iter ()) { c.source_gid = baseglyph_paintrecord.glyphId; + c.visited_paint.clear (); const Paint &paint = &baseglyph_paintrecords+baseglyph_paintrecord.paint; paint.dispatch (&c); diff --git a/src/OT/Layout/GSUB/Ligature.hh b/src/OT/Layout/GSUB/Ligature.hh index 91a810698..38e6965c7 100644 --- a/src/OT/Layout/GSUB/Ligature.hh +++ b/src/OT/Layout/GSUB/Ligature.hh @@ -44,8 +44,15 @@ struct Ligature hb_set_t complete_ligset; complete_ligset.add (first); + hb_iter (component) | hb_sink (complete_ligset); + if (unlikely (complete_ligset.in_error ())) + { + c->depend_data->fail (); + return; + } hb_codepoint_t ligset_idx = c->depend_data->new_ligature_set(complete_ligset); + if (unlikely (ligset_idx == HB_CODEPOINT_INVALID)) + return; // Track whether any edge using this ligset_idx was actually added bool any_added = false; diff --git a/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh b/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh index dfa17d8a0..48d7d62c3 100644 --- a/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh +++ b/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh @@ -90,6 +90,8 @@ struct ReverseChainSingleSubstFormat1 else if (back_glyphs.get_population () > 1) { hb_codepoint_t set_idx = c->depend_data->find_or_create_context_set (back_glyphs); + if (unlikely (set_idx == HB_CODEPOINT_INVALID)) + return; context_glyphs.add (HB_DEPEND_CONTEXT_SET_FLAG | set_idx); } } @@ -105,14 +107,24 @@ struct ReverseChainSingleSubstFormat1 else if (look_glyphs.get_population () > 1) { hb_codepoint_t set_idx = c->depend_data->find_or_create_context_set (look_glyphs); + if (unlikely (set_idx == HB_CODEPOINT_INVALID)) + return; context_glyphs.add (HB_DEPEND_CONTEXT_SET_FLAG | set_idx); } } /* Allocate context set and save/restore around edge creation */ + if (unlikely (context_glyphs.in_error ())) + { + c->depend_data->fail (); + return; + } hb_codepoint_t context_set_idx = context_glyphs.is_empty () ? HB_CODEPOINT_INVALID : c->depend_data->find_or_create_context_set (context_glyphs); + if (unlikely (!context_glyphs.is_empty () && + context_set_idx == HB_CODEPOINT_INVALID)) + return; hb_codepoint_t saved_context = c->depend_data->current_context_set_index; c->depend_data->current_context_set_index = context_set_idx; diff --git a/src/hb-depend-data.hh b/src/hb-depend-data.hh index a88f287d3..5fc7db7c1 100644 --- a/src/hb-depend-data.hh +++ b/src/hb-depend-data.hh @@ -302,7 +302,7 @@ struct hb_depend_data_builder_t return; } data.sets[set_index]->clear (); - free_set_list.push (set_index); + check_success (free_set_list.push_or_fail (set_index)); } /* Allocate a new ligature set (no deduplication). */ @@ -321,16 +321,23 @@ struct hb_depend_data_builder_t { set_index = free_set_list.pop (); data.sets[set_index]->set (set); + if (unlikely (data.sets[set_index]->in_error ())) + return fail_invalid (); } else { set_index = data.sets.length; hb_set_t *new_set = hb_set_create (); if (unlikely (!new_set)) - return HB_CODEPOINT_INVALID; + return fail_invalid (); new_set->set (set); + if (unlikely (new_set->in_error ())) + { + hb_set_destroy (new_set); + return fail_invalid (); + } if (unlikely (!data.sets.push_or_fail (hb::unique_ptr {new_set}))) - return HB_CODEPOINT_INVALID; + return fail_invalid (); } return set_index; @@ -348,7 +355,8 @@ struct hb_depend_data_builder_t if (unlikely (new_idx == HB_CODEPOINT_INVALID)) return HB_CODEPOINT_INVALID; - set_to_index.set (data.sets[new_idx].get (), new_idx); + if (unlikely (!set_to_index.set (data.sets[new_idx].get (), new_idx))) + return fail_invalid (); return new_idx; } @@ -401,10 +409,14 @@ struct hb_depend_data_builder_t hb_set_t filtered_set; filtered_set.set (back_set); filtered_set.subtract (direct_requirements); + if (unlikely (filtered_set.in_error ())) + return fail_invalid (); if (!filtered_set.is_empty ()) { hb_codepoint_t set_idx = find_or_create_context_set (filtered_set); + if (unlikely (set_idx == HB_CODEPOINT_INVALID)) + return HB_CODEPOINT_INVALID; context_elements.add (HB_DEPEND_CONTEXT_SET_FLAG | set_idx); } } @@ -420,10 +432,14 @@ struct hb_depend_data_builder_t hb_set_t filtered_set; filtered_set.set (look_set); filtered_set.subtract (direct_requirements); + if (unlikely (filtered_set.in_error ())) + return fail_invalid (); if (!filtered_set.is_empty ()) { hb_codepoint_t set_idx = find_or_create_context_set (filtered_set); + if (unlikely (set_idx == HB_CODEPOINT_INVALID)) + return HB_CODEPOINT_INVALID; context_elements.add (HB_DEPEND_CONTEXT_SET_FLAG | set_idx); } } @@ -431,6 +447,9 @@ struct hb_depend_data_builder_t } context_elements.union_ (direct_requirements); + if (unlikely (direct_requirements.in_error () || + context_elements.in_error ())) + return fail_invalid (); if (context_elements.is_empty ()) return HB_CODEPOINT_INVALID; @@ -455,11 +474,13 @@ struct hb_depend_data_builder_t if (seen_edges.has (key)) return false; - seen_edges.set (key, true); + if (unlikely (!seen_edges.set (key, true))) + return fail (); auto &gdr = data.glyph_dependencies[target]; - gdr.dependencies.push (table_tag, dependent, layout_tag, lig_set, - context_set, flags); + if (unlikely (!gdr.dependencies.push_or_fail (table_tag, dependent, layout_tag, + lig_set, context_set, flags))) + return fail (); return true; } @@ -495,6 +516,8 @@ struct hb_depend_data_builder_t HB_INTERNAL bool compile (hb_face_t *face); + bool fail () { successful = false; return false; } + hb_codepoint_t fail_invalid () { fail (); return HB_CODEPOINT_INVALID; } bool check_success (bool s) { successful = (successful && s); return successful; } HB_INTERNAL void get_gsub_dependencies (hb_face_t *face); diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index f7e908530..9fef01155 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -443,9 +443,9 @@ struct hb_depend_context_t : hb_vector_t lookahead_sets; /* Sets of glyphs in lookahead positions */ }; - void push_context (context_info_t &&ctx) + bool push_context (context_info_t &&ctx) { - context_stack.push (std::move (ctx)); + return depend_data->check_success (context_stack.push_or_fail (std::move (ctx))); } void pop_context () @@ -1976,6 +1976,11 @@ static void context_depend_recurse_lookups (hb_depend_context_t *c, hb_set_t filtered; filtered.set (*original_set); filtered.subtract (position_context); + if (unlikely (filtered.in_error ())) + { + c->depend_data->fail (); + return; + } if (filtered == *original_set) { /* No overlap with position_context - add full requirement */ @@ -1993,10 +1998,17 @@ static void context_depend_recurse_lookups (hb_depend_context_t *c, hb_set_t filtered; filtered.set ((*input_position_glyphs)[j]); filtered.subtract (position_context); + if (unlikely (filtered.in_error ())) + { + c->depend_data->fail (); + return; + } if (filtered == (*input_position_glyphs)[j]) { /* No overlap with position_context - add full requirement */ hb_codepoint_t idx = c->depend_data->find_or_create_context_set ((*input_position_glyphs)[j]); + if (unlikely (idx == HB_CODEPOINT_INVALID)) + return; filtered_disjunctive_indices.add (HB_DEPEND_CONTEXT_SET_FLAG | idx); } /* Otherwise: position_context intersects, requirement satisfied */ @@ -2005,11 +2017,20 @@ static void context_depend_recurse_lookups (hb_depend_context_t *c, /* Combine direct + disjunctive */ position_context.union_ (filtered_disjunctive_indices); + if (unlikely (position_context.in_error () || + filtered_disjunctive_indices.in_error ())) + { + c->depend_data->fail (); + return; + } /* Allocate final context_set */ hb_codepoint_t context_set_idx = position_context.is_empty () ? HB_CODEPOINT_INVALID : c->depend_data->find_or_create_context_set (position_context); + if (unlikely (!position_context.is_empty () && + context_set_idx == HB_CODEPOINT_INVALID)) + return; /* Save outer context to restore after this lookup. When a contextual lookup * calls another contextual lookup, we want each lookup in this rule to see @@ -2078,7 +2099,11 @@ static void context_depend_recurse_lookups (hb_depend_context_t *c, covered_seq_indicies.add (seqIndex); hb_set_t *cur_active_glyphs = c->push_cur_active_glyphs (); if (unlikely (!cur_active_glyphs)) + { + c->depend_data->current_context_set_index = saved_context_set_index; + c->depend_data->current_edge_flags = saved_edge_flags; return; + } if (has_pos_glyphs) { *cur_active_glyphs = std::move (pos_glyphs); } else { @@ -2351,7 +2376,11 @@ static inline void context_depend_lookup (hb_depend_context_t *c, collect_coverage (&pos0_glyphs, value, lookup_context.intersects_data); break; } - input_position_glyphs.push (pos0_glyphs); + if (unlikely (!input_position_glyphs.push_or_fail (pos0_glyphs))) + { + c->depend_data->fail (); + return; + } /* Positions 1+ (Input array) */ for (unsigned i = 0; i < inputCount - 1; i++) @@ -2369,12 +2398,17 @@ static inline void context_depend_lookup (hb_depend_context_t *c, collect_coverage (&pos_glyphs, input[i], lookup_context.intersects_data); break; } - input_position_glyphs.push (pos_glyphs); + if (unlikely (!input_position_glyphs.push_or_fail (pos_glyphs))) + { + c->depend_data->fail (); + return; + } } /* Push context before recursing (for backtrack/lookahead tracking - empty for ContextSubst) */ typename hb_depend_context_t::context_info_t ctx_info; - c->push_context (std::move (ctx_info)); + if (unlikely (!c->push_context (std::move (ctx_info)))) + return; context_depend_recurse_lookups (c, inputCount, input, @@ -3665,7 +3699,13 @@ static inline void chain_context_depend_lookup (hb_depend_context_t *c, break; } if (!pos_glyphs.is_empty ()) - ctx_info.backtrack_sets.push (pos_glyphs); + { + if (unlikely (!ctx_info.backtrack_sets.push_or_fail (pos_glyphs))) + { + c->depend_data->fail (); + return; + } + } } /* Extract lookahead glyphs */ @@ -3685,7 +3725,13 @@ static inline void chain_context_depend_lookup (hb_depend_context_t *c, break; } if (!pos_glyphs.is_empty ()) - ctx_info.lookahead_sets.push (pos_glyphs); + { + if (unlikely (!ctx_info.lookahead_sets.push_or_fail (pos_glyphs))) + { + c->depend_data->fail (); + return; + } + } } /* Build preliminary_context with backtrack + lookahead encoded */ @@ -3696,6 +3742,8 @@ static inline void chain_context_depend_lookup (hb_depend_context_t *c, preliminary_context.add (back_set.get_min ()); // Direct glyph } else if (back_set.get_population () > 1) { hb_codepoint_t set_idx = c->depend_data->find_or_create_context_set (back_set); + if (unlikely (set_idx == HB_CODEPOINT_INVALID)) + return; preliminary_context.add (HB_DEPEND_CONTEXT_SET_FLAG | set_idx); // Encoded set reference } } @@ -3705,9 +3753,16 @@ static inline void chain_context_depend_lookup (hb_depend_context_t *c, preliminary_context.add (look_set.get_min ()); // Direct glyph } else if (look_set.get_population () > 1) { hb_codepoint_t set_idx = c->depend_data->find_or_create_context_set (look_set); + if (unlikely (set_idx == HB_CODEPOINT_INVALID)) + return; preliminary_context.add (HB_DEPEND_CONTEXT_SET_FLAG | set_idx); // Encoded set reference } } + if (unlikely (preliminary_context.in_error ())) + { + c->depend_data->fail (); + return; + } /* Build glyph sets for ALL input positions */ hb_vector_t input_position_glyphs; @@ -3728,7 +3783,11 @@ static inline void chain_context_depend_lookup (hb_depend_context_t *c, collect_coverage (&pos0_glyphs, value, lookup_context.intersects_data[1]); break; } - input_position_glyphs.push (pos0_glyphs); + if (unlikely (!input_position_glyphs.push_or_fail (pos0_glyphs))) + { + c->depend_data->fail (); + return; + } /* Positions 1+ (Input array) */ for (unsigned i = 0; i < inputCount - 1; i++) @@ -3746,11 +3805,16 @@ static inline void chain_context_depend_lookup (hb_depend_context_t *c, collect_coverage (&pos_glyphs, input[i], lookup_context.intersects_data[1]); break; } - input_position_glyphs.push (pos_glyphs); + if (unlikely (!input_position_glyphs.push_or_fail (pos_glyphs))) + { + c->depend_data->fail (); + return; + } } /* Push context before recursing (use move to avoid copy issues) */ - c->push_context (std::move (ctx_info)); + if (unlikely (!c->push_context (std::move (ctx_info)))) + return; context_depend_recurse_lookups (c, inputCount, input, diff --git a/src/hb-subset.h b/src/hb-subset.h index 53f64233c..c74ce5439 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -30,6 +30,7 @@ #include "hb.h" #include "hb-ot.h" +#include "hb-subset-serialize.h" #include "hb-subset-depend.h" #include "hb-subset-serialize.h" diff --git a/test/api/test-ot-depend.c b/test/api/test-ot-depend.c index 2345ba25e..14e9b214b 100644 --- a/test/api/test-ot-depend.c +++ b/test/api/test-ot-depend.c @@ -387,7 +387,7 @@ test_depend_math (void) static void test_depend_gsub_formats (void) { - hb_tag_t layout_tag; + hb_tag_t layout_tag = HB_TAG_NONE; hb_codepoint_t ligature_set; /* ===== BASIC SUBSTITUTION TYPES ===== */ diff --git a/test/api/test-subset-repacker.c b/test/api/test-subset-repacker.c index 8f478fa22..19a0755e6 100644 --- a/test/api/test-subset-repacker.c +++ b/test/api/test-subset-repacker.c @@ -26,7 +26,7 @@ #include "hb-test.h" #include "hb-subset-test.h" -#include "hb-subset-serialize.h" +#include "hb-subset.h" char test_gsub_data[106] = "\x0\x1\x0\x0\x0\xa\x0\x1e\x0\x2c\x0\x1\x6c\x61\x74\x6e\x0\x8\x0\x4\x0\x0\x0\x0\xff\xff\x0\x1\x0\x0\x0\x1\x74\x65\x73\x74\x0\x8\x0\x0\x0\x1\x0\x1\x0\x2\x0\x2a\x0\x6\x0\x5\x0\x0\x0\x1\x0\x8\x0\x1\x0\x8\x0\x1\x0\xe\x0\x1\x0\x1\x0\x1\x0\x1\x0\x4\x0\x2\x0\x1\x0\x2\x0\x1\x0\x0\x0\x1\x0\x0\x0\x1\x0\x8\x0\x1\x0\x6\x0\x1\x0\x1\x0\x1\x0\x2"; diff --git a/test/fuzzing/hb-depend-closure-parity.cc b/test/fuzzing/hb-depend-closure-parity.cc index 8ba595c8b..e934c29c5 100644 --- a/test/fuzzing/hb-depend-closure-parity.cc +++ b/test/fuzzing/hb-depend-closure-parity.cc @@ -634,7 +634,7 @@ static bool compare_closures (hb_face_t *face, hb_subset_depend_t *depend, uint64_t seed, const char *font_path, bool is_gsub, hb_set_t *start_glyphs, hb_set_t *codepoints, - hb_set_t *test_features) + hb_set_t *test_features, hb_map_t *unicode_to_glyph_cache) { bool skip_gsub = !is_gsub; @@ -715,14 +715,19 @@ compare_closures (hb_face_t *face, hb_subset_depend_t *depend, } else { - hb_map_t *unicode_to_glyph = hb_map_create (); - hb_face_collect_nominal_glyph_mapping (face, unicode_to_glyph, NULL); + hb_map_t *unicode_to_glyph = unicode_to_glyph_cache; + if (!unicode_to_glyph) + { + unicode_to_glyph = hb_map_create (); + hb_face_collect_nominal_glyph_mapping (face, unicode_to_glyph, NULL); + } int idx = -1; hb_codepoint_t unicode, glyph; while (hb_map_next (unicode_to_glyph, &idx, &unicode, &glyph)) if (hb_set_has (actual_start_glyphs, glyph)) hb_set_add (uvs_unicodes, unicode); - hb_map_destroy (unicode_to_glyph); + if (!unicode_to_glyph_cache) + hb_map_destroy (unicode_to_glyph); } bool hit_flagged_edge = false; @@ -1284,6 +1289,13 @@ generate_test_from_seed (uint64_t seed, hb_face_t *face, hb_font_t *font) /* Step 1: Determine test type and size range from seed % 100 */ unsigned type_selector = seed % 100; + /* Glyph-starting non-GSUB tests force subset-plan to reverse-map retained + * glyphs through cmap. Fonts like AdobeBlank cover most of Unicode, making + * that path too expensive to run hundreds of times in one Meson test. Use + * codepoint-starting tests for huge-cmap fonts; table dependency coverage + * still comes from the rest of the corpus. */ + if (num_codepoints > 65536) + type_selector = 58 + (type_selector % 42); unsigned min_size, max_size; if (type_selector < 21) { @@ -1334,17 +1346,23 @@ generate_test_from_seed (uint64_t seed, hb_face_t *face, hb_font_t *font) hb_set_t *cp_indices = hb_set_create (); rng_select_distinct (selection_rng, cp_indices, params.target_size, num_codepoints); - hb_codepoint_t idx = HB_SET_VALUE_INVALID; - while (hb_set_next (cp_indices, &idx)) + hb_codepoint_t next_idx = HB_SET_VALUE_INVALID; + hb_codepoint_t cp = HB_SET_VALUE_INVALID; + unsigned current_idx = 0; + bool have_idx = hb_set_next (cp_indices, &next_idx); + while (have_idx && hb_set_next (all_codepoints, &cp)) { - hb_codepoint_t cp = HB_SET_VALUE_INVALID; - for (unsigned j = 0; j <= idx && hb_set_next (all_codepoints, &cp); j++) - ; - hb_set_add (params.codepoints, cp); + while (have_idx && current_idx == next_idx) + { + hb_set_add (params.codepoints, cp); - hb_codepoint_t gid; - if (hb_font_get_nominal_glyph (font, cp, &gid)) - hb_set_add (params.glyphs, gid); + hb_codepoint_t gid; + if (hb_font_get_nominal_glyph (font, cp, &gid)) + hb_set_add (params.glyphs, gid); + + have_idx = hb_set_next (cp_indices, &next_idx); + } + current_idx++; } hb_set_destroy (cp_indices); @@ -1451,6 +1469,7 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) } hb_font_t *font = hb_font_create (face); + hb_map_t *unicode_to_glyph_cache = nullptr; if (_hb_depend_fuzzer_explicit_test) { @@ -1460,8 +1479,14 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) else { print_test_params (0, params.is_gsub, params.glyphs, params.codepoints, params.features); + if (!params.is_gsub && !unicode_to_glyph_cache) + { + unicode_to_glyph_cache = hb_map_create (); + hb_face_collect_nominal_glyph_mapping (face, unicode_to_glyph_cache, NULL); + } compare_closures (face, depend, 0, _hb_depend_fuzzer_current_font_path, - params.is_gsub, params.glyphs, params.codepoints, params.features); + params.is_gsub, params.glyphs, params.codepoints, params.features, + unicode_to_glyph_cache); } if (params.glyphs) hb_set_destroy (params.glyphs); if (params.codepoints) hb_set_destroy (params.codepoints); @@ -1476,8 +1501,14 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) else { print_test_params (test_seed, params.is_gsub, params.glyphs, params.codepoints, params.features); + if (!params.is_gsub && !unicode_to_glyph_cache) + { + unicode_to_glyph_cache = hb_map_create (); + hb_face_collect_nominal_glyph_mapping (face, unicode_to_glyph_cache, NULL); + } compare_closures (face, depend, test_seed, _hb_depend_fuzzer_current_font_path, - params.is_gsub, params.glyphs, params.codepoints, params.features); + params.is_gsub, params.glyphs, params.codepoints, params.features, + unicode_to_glyph_cache); } if (params.glyphs) hb_set_destroy (params.glyphs); if (params.codepoints) hb_set_destroy (params.codepoints); @@ -1501,8 +1532,15 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) if (_hb_depend_fuzzer_verbose) print_test_params (test_seed, params.is_gsub, params.glyphs, params.codepoints, params.features); + if (!params.is_gsub && !unicode_to_glyph_cache) + { + unicode_to_glyph_cache = hb_map_create (); + hb_face_collect_nominal_glyph_mapping (face, unicode_to_glyph_cache, NULL); + } + compare_closures (face, depend, test_seed, _hb_depend_fuzzer_current_font_path, - params.is_gsub, params.glyphs, params.codepoints, params.features); + params.is_gsub, params.glyphs, params.codepoints, params.features, + unicode_to_glyph_cache); if (params.glyphs) hb_set_destroy (params.glyphs); if (params.codepoints) hb_set_destroy (params.codepoints); @@ -1510,6 +1548,8 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) } } + if (unicode_to_glyph_cache) + hb_map_destroy (unicode_to_glyph_cache); hb_font_destroy (font); hb_subset_depend_destroy (depend); hb_face_destroy (face); diff --git a/test/fuzzing/hb-repacker-fuzzer.cc b/test/fuzzing/hb-repacker-fuzzer.cc index f7caeee0f..3f076838d 100644 --- a/test/fuzzing/hb-repacker-fuzzer.cc +++ b/test/fuzzing/hb-repacker-fuzzer.cc @@ -5,7 +5,7 @@ #include #include -#include "hb-subset-serialize.h" +#include "hb-subset.h" typedef struct { diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index 87ecb8383..46e41b730 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -122,9 +122,18 @@ fonts_glob = run_command(glob_cmd, meson.current_source_dir() / 'fonts', check:t subset_fonts_glob = run_command(glob_cmd, meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts', check:true).stdout().strip().split('\n') graphs_glob = run_command(glob_cmd, meson.current_source_dir() / 'graphs', check:true).stdout().strip().split('\n') +depend_closure_parity_fonts_glob = [] +foreach font : subset_fonts_glob + # These fonts currently spend tens of seconds or more building the + # contextual GSUB dependency graph before the parity tests start. + if not font.contains('NotoNastaliqUrdu-Bold.ttf') and not font.contains('NotoNastaliqUrdu-Regular.ttf') + depend_closure_parity_fonts_glob += [font] + endif +endforeach + # Chunk the glob lists to avoid command line length limits, and for parallelization chunk_size = 64 -foreach glob_name : ['fonts_glob', 'subset_fonts_glob', 'graphs_glob'] +foreach glob_name : ['fonts_glob', 'subset_fonts_glob', 'depend_closure_parity_fonts_glob', 'graphs_glob'] glob = get_variable(glob_name) chunks = [] chunk = [] @@ -227,10 +236,10 @@ endif if conf.get('HB_EXPERIMENTAL_API', 0) == 1 i = 0 - foreach chunk : subset_fonts_glob_chunks + foreach chunk : depend_closure_parity_fonts_glob_chunks test('depend-closure-parity-chunk-@0@'.format(i), hb_depend_closure_parity_exe, - args: ['-s', '42'] + chunk, + args: ['-s', '42', '-n', '16'] + chunk, workdir: meson.current_build_dir() / '..' / '..', protocol: 'tap', suite: ['fuzzing'],