From c453c2fce990b066155ccb72d8a39eba55e42a2d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 23 Dec 2022 11:33:23 -0700 Subject: [PATCH] [ft-colr] Fix color-stop iteration --- src/hb-ft-colr.hh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hb-ft-colr.hh b/src/hb-ft-colr.hh index c0e29ebfe..db52d8d0b 100644 --- a/src/hb-ft-colr.hh +++ b/src/hb-ft-colr.hh @@ -93,7 +93,16 @@ _hb_ft_color_line_get_color_stops (hb_color_line_t *color_line, unsigned wrote = 0; FT_ColorStopIterator iter = c->color_stop_iterator; - c->color_stop_iterator.current_color_stop = start; + if (start >= c->color_stop_iterator.num_color_stops) + { + *count = 0; + return c->color_stop_iterator.num_color_stops; + } + + while (c->color_stop_iterator.current_color_stop < start) + FT_Get_Colorline_Stops(data->face, + &stop, + &c->color_stop_iterator); while (count && *count && FT_Get_Colorline_Stops(data->face,