summaryrefslogtreecommitdiff
path: root/external/libodfgen
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-07-29 16:45:50 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-08-01 17:20:17 +0200
commitfa759359587808f5e74217e558ee3dd9143710f7 (patch)
treea0db65610096822c78c46df69e9ca4e205b99d89 /external/libodfgen
parentbf4ebb17c09d6e78e0f6676a127aecf67a817982 (diff)
external/libodfgen: Avoid division by zero for empty elliptical arc
...as seen when running under UBSan `instdir/program/soffice --headless --convert-to epub` of caolan/libmspub_icu_global_buffer_overflow.sample from the crash-testing corpus. <https://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes> specifies: "If the endpoints (x1, y1) and (x2, y2) are identical, then this is equivalent to omitting the elliptical arc segment entirely." (And getEllipticalArgBox's xmin, ymin, xmax, and ymax out parameters are pre-filled with suitable values at the call site in getPathBBox, so that we can return here without setting those out parameters.) Change-Id: I6b0b693354648f4015cec2395737fb9abe5ae956 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119680 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external/libodfgen')
-rw-r--r--external/libodfgen/UnpackedTarball_libodfgen.mk4
-rw-r--r--external/libodfgen/ellipticalarc.patch13
2 files changed, 17 insertions, 0 deletions
diff --git a/external/libodfgen/UnpackedTarball_libodfgen.mk b/external/libodfgen/UnpackedTarball_libodfgen.mk
index d6c84e517970..89ff9eba353f 100644
--- a/external/libodfgen/UnpackedTarball_libodfgen.mk
+++ b/external/libodfgen/UnpackedTarball_libodfgen.mk
@@ -15,6 +15,10 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libodfgen,0))
$(eval $(call gb_UnpackedTarball_update_autoconf_configs,libodfgen))
+$(eval $(call gb_UnpackedTarball_add_patches,libodfgen, \
+ external/libodfgen/ellipticalarc.patch \
+))
+
ifeq ($(SYSTEM_REVENGE),)
$(eval $(call gb_UnpackedTarball_add_patches,libodfgen, \
external/libodfgen/rpath.patch \
diff --git a/external/libodfgen/ellipticalarc.patch b/external/libodfgen/ellipticalarc.patch
new file mode 100644
index 000000000000..27aaee77cb8a
--- /dev/null
+++ b/external/libodfgen/ellipticalarc.patch
@@ -0,0 +1,13 @@
+--- src/GraphicFunctions.cxx
++++ src/GraphicFunctions.cxx
+@@ -59,6 +59,10 @@
+ double rx, double ry, double phi, bool largeArc, bool sweep, double x, double y,
+ double &xmin, double &ymin, double &xmax, double &ymax)
+ {
++ if (x0 == x && y0 == y) {
++ return;
++ }
++
+ phi *= M_PI/180;
+ if (rx < 0.0)
+ rx *= -1.0;