[cairo-commit] 2 commits - src/cairo-pen.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 3 15:46:05 UTC 2023


 src/cairo-pen.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 3b178e85867029a7fa53b4c314c96681a23016bf
Merge: 1f9004b3d 311f5e10c
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Mar 3 15:46:03 2023 +0000

    Merge branch 'ofz46165' into 'master'
    
    ofz#46165 avoid a divide by zero seen fuzzing libreoffice rendering
    
    See merge request cairo/cairo!351

commit 311f5e10cd58cc3fadd71b02963fdfc414b33a57
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 31 10:14:18 2022 +0100

    ofz#46165 avoid a divide by zero seen fuzzing libreoffice rendering

diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index 9bf960423..a4b84aae5 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -289,7 +289,12 @@ _cairo_pen_vertices_needed (double	    tolerance,
     } 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)


More information about the cairo-commit mailing list