diff --git a/src/graph/gsubgpos-graph.hh b/src/graph/gsubgpos-graph.hh index 50dc03e3c..2a382598f 100644 --- a/src/graph/gsubgpos-graph.hh +++ b/src/graph/gsubgpos-graph.hh @@ -178,9 +178,7 @@ struct Lookup : public OT::Lookup if (new_sub_tables.in_error ()) return false; if (!new_sub_tables) continue; - hb_pair_t>* entry = all_new_subtables.push (); - entry->first = i; - entry->second = std::move (new_sub_tables); + all_new_subtables.push (hb_pair (i, std::move (new_sub_tables))); } if (all_new_subtables) { @@ -205,7 +203,7 @@ struct Lookup : public OT::Lookup bool add_sub_tables (gsubgpos_graph_context_t& c, unsigned this_index, unsigned type, - hb_vector_t>>& subtable_ids) + const hb_vector_t>>& subtable_ids) { bool is_ext = is_extension (c.table_tag); auto* v = &c.graph.vertices_[this_index]; @@ -272,7 +270,7 @@ struct Lookup : public OT::Lookup void fix_existing_subtable_links (gsubgpos_graph_context_t& c, unsigned this_index, - hb_vector_t>>& subtable_ids) + const hb_vector_t>>& subtable_ids) { auto& v = c.graph.vertices_[this_index]; Lookup* lookup = (Lookup*) v.obj.head; @@ -326,7 +324,7 @@ struct Lookup : public OT::Lookup unsigned* existing_ext_index = nullptr; if (c.subtable_to_extension.has(subtable_index, &existing_ext_index)) { ext_index = *existing_ext_index; - } else { + } else { ext_index = create_extension_subtable(c, subtable_index, type); c.subtable_to_extension.set(subtable_index, ext_index); } diff --git a/src/graph/split-helpers.hh b/src/graph/split-helpers.hh index 61fd7c2d2..f1f86e332 100644 --- a/src/graph/split-helpers.hh +++ b/src/graph/split-helpers.hh @@ -49,7 +49,7 @@ hb_vector_t actuate_subtable_split (Context& split_context, if (id == (unsigned) -1) { new_objects.reset (); - new_objects.allocated = -1; // mark error + new_objects.ensure_error (); return new_objects; } new_objects.push (id); @@ -58,7 +58,7 @@ hb_vector_t actuate_subtable_split (Context& split_context, if (!split_context.shrink (split_points[0])) { new_objects.reset (); - new_objects.allocated = -1; // mark error + new_objects.ensure_error (); } return new_objects; diff --git a/src/hb-vector.hh b/src/hb-vector.hh index dc34f4155..e8b8ba9bb 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -313,6 +313,11 @@ struct hb_vector_t assert (allocated < 0); allocated = -(allocated + 1); } + void ensure_error () + { + if (!in_error ()) + set_error (); + } Type * _realloc (unsigned new_allocated) diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-6083012753424384 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-6083012753424384 new file mode 100644 index 000000000..b7209919c Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-6083012753424384 differ