From 47baa1da6bbf386d7be73ca4a79d2c819ca2a3c9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 20 Jan 2023 23:38:22 -0500 Subject: [PATCH] [hb-cairo] Fixes for sweep gradients Make reversed angles not infloop, and cap the number of interval repetitions at 1000. Fixes: https://github.com/harfbuzz/harfbuzz/issues/4055 --- src/hb-cairo-utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-cairo-utils.cc b/src/hb-cairo-utils.cc index ad0627c00..10a811bdf 100644 --- a/src/hb-cairo-utils.cc +++ b/src/hb-cairo-utils.cc @@ -723,8 +723,9 @@ _hb_cairo_add_sweep_gradient_patches (hb_color_stop_t *stops, } //assert (angles[0] + k * span <= 0 && 0 < angles[n_stops - 1] + k * span); + span = fabs (span); - for (unsigned l = k; 1; l++) + for (unsigned l = k; l < 1000; l++) { for (unsigned i = 1; i < n_stops; i++) {