summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-06-23 09:49:20 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-07-04 11:17:21 -0400
commit310f8269686b36a4bcc95560246a39e0ecfe4be5 (patch)
tree7e3ba6a89317bdbee9ff41ad065e998f25cd6975
parentf6ee844a49e2e40ecb12384242fc34bff21bc3db (diff)
downloadpango-310f8269686b36a4bcc95560246a39e0ecfe4be5.tar.gz
Be careful with acos
If the input is outside the [0, 1] range, acos returns NaN, so clamp to be safe.
-rw-r--r--pango/pango-matrix.c2
1 files changed, 1 insertions, 1 deletions
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.)));
}
/**