From 8685653cc7dbf443e996b28a07531ed0f5bc2567 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 6 Mar 2025 17:28:09 -0700 Subject: [PATCH] [ft-colr] Fix crash if palette index is out-of-range --- src/hb-ft-colr.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hb-ft-colr.hh b/src/hb-ft-colr.hh index c96698369..c91572278 100644 --- a/src/hb-ft-colr.hh +++ b/src/hb-ft-colr.hh @@ -167,7 +167,7 @@ _hb_ft_color_line_get_color_stops (hb_color_line_t *color_line, hb_color_get_red (color), (hb_color_get_alpha (color) * stop.color.alpha) >> 14); } - else + else if (c->palette) { FT_Color ft_color = c->palette[stop.color.palette_index]; color_stops->color = HB_COLOR (ft_color.blue, @@ -175,6 +175,8 @@ _hb_ft_color_line_get_color_stops (hb_color_line_t *color_line, ft_color.red, (ft_color.alpha * stop.color.alpha) >> 14); } + else + color_stops->color = HB_COLOR (0, 0, 0, 0); } color_stops++;