From 310f8269686b36a4bcc95560246a39e0ecfe4be5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 23 Jun 2022 09:49:20 -0400 Subject: Be careful with acos If the input is outside the [0, 1] range, acos returns NaN, so clamp to be safe. --- pango/pango-matrix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pango/pango-matrix.c b/pango/pango-matrix.c index 78aacae6..3f263101 100644 --- a/pango/pango-matrix.c +++ b/pango/pango-matrix.c @@ -269,7 +269,7 @@ pango_matrix_get_rotation (const PangoMatrix *matrix) pango_matrix_transform_distance (matrix, &x, &y); - return RAD_TO_DEG (acos (x / sqrtf (x*x + y*y))); + return RAD_TO_DEG (acos (CLAMP (x / sqrtf (x*x + y*y), -1., 1.))); } /** -- cgit v1.2.1