diff --git a/src/OT/glyf/glyf.hh b/src/OT/glyf/glyf.hh index 541d5d1e2..bc5608d4f 100644 --- a/src/OT/glyf/glyf.hh +++ b/src/OT/glyf/glyf.hh @@ -98,11 +98,17 @@ struct glyf hb_vector_t padded_offsets; unsigned num_glyphs = c->plan->num_output_glyphs (); if (unlikely (!padded_offsets.resize (num_glyphs))) + { + hb_font_destroy (font); return false; + } hb_vector_t glyphs; if (!_populate_subset_glyphs (c->plan, font, glyphs)) + { + hb_font_destroy (font); return false; + } if (font) hb_font_destroy (font); @@ -464,7 +470,10 @@ glyf::_create_font_for_instancing (const hb_subset_plan_t *plan) const hb_vector_t vars; if (unlikely (!vars.alloc (plan->user_axes_location.get_population (), true))) + { + hb_font_destroy (font); return nullptr; + } for (auto _ : plan->user_axes_location) { diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-6525813890875392 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-6525813890875392 new file mode 100644 index 000000000..0ece6d74e Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-6525813890875392 differ