diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index 57f4d890c..56f4d1f1c 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh @@ -423,7 +423,10 @@ struct Glyph gvar_cache, phantom_only && type == SIMPLE, budget)) + { + points.resize (old_length); return false; + } } #endif diff --git a/src/OT/glyf/glyf.hh b/src/OT/glyf/glyf.hh index 5b22b931a..3a9916150 100644 --- a/src/OT/glyf/glyf.hh +++ b/src/OT/glyf/glyf.hh @@ -297,6 +297,9 @@ struct glyf_accelerator_t auto &all_points = scratch.all_points; all_points.clear (); + /* The scratch is cached across loads; don't let a failed one leave + * component points behind. */ + scratch.comp_points.clear (); bool phantom_only = !consumer.is_consuming_contour_points (); if (unlikely (!glyph_for_gid (gid).get_points (font, *this, all_points, scratch, nullptr, nullptr, nullptr, true, true, phantom_only, coords, gvar_cache, 0, nullptr, budget))) diff --git a/test/fuzzing/fonts/glyf-gvar-truncated-tuple-varc-scratch-growth.ttf b/test/fuzzing/fonts/glyf-gvar-truncated-tuple-varc-scratch-growth.ttf new file mode 100644 index 000000000..05e15c7b0 Binary files /dev/null and b/test/fuzzing/fonts/glyf-gvar-truncated-tuple-varc-scratch-growth.ttf differ