summaryrefslogtreecommitdiff
path: root/external/cairo
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-03-30 09:53:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-03-30 12:20:52 +0200
commitefb6845d42c44bbd75771cc1641bc5f2225d8a96 (patch)
tree48f4966607ed470a9aba2eeb70ecdb743eb73268 /external/cairo
parent72499d57daf8f53dae268b2160fa0585ed0bd36d (diff)
ofz#46165 ubsan Divide-by-zero
Change-Id: I5c56eae4456a03550770035610745de3be074679 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132299 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'external/cairo')
-rw-r--r--external/cairo/UnpackedTarball_cairo.mk1
-rw-r--r--external/cairo/cairo/cairo.ofz46165.patch.116
2 files changed, 17 insertions, 0 deletions
diff --git a/external/cairo/UnpackedTarball_cairo.mk b/external/cairo/UnpackedTarball_cairo.mk
index 49a4a726bbe2..a2e9eb894d75 100644
--- a/external/cairo/UnpackedTarball_cairo.mk
+++ b/external/cairo/UnpackedTarball_cairo.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,cairo,\
external/cairo/cairo/san.patch.0 \
external/cairo/cairo/0001-Fix-mask-usage-in-image-compositor.patch.1 \
external/cairo/cairo/cairo-fix_function_signature.patch.1 \
+ external/cairo/cairo/cairo.ofz46165.patch.1 \
))
ifeq ($(OS),iOS)
diff --git a/external/cairo/cairo/cairo.ofz46165.patch.1 b/external/cairo/cairo/cairo.ofz46165.patch.1
new file mode 100644
index 000000000000..948313c2a186
--- /dev/null
+++ b/external/cairo/cairo/cairo.ofz46165.patch.1
@@ -0,0 +1,16 @@
+--- a/src/cairo-pen.c 2022-03-30 09:48:14.702456922 +0100
++++ b/src/cairo-pen.c 2022-03-30 09:50:40.011793460 +0100
+@@ -289,7 +289,12 @@
+ } else if (tolerance >= major_axis) {
+ num_vertices = 4;
+ } else {
+- num_vertices = ceil (2*M_PI / acos (1 - tolerance / major_axis));
++ double divisor = acos (1 - tolerance / major_axis);
++
++ if (divisor == 0.0)
++ return 4;
++
++ num_vertices = ceil (2*M_PI / divisor);
+
+ /* number of vertices must be even */
+ if (num_vertices % 2)