>From f30a1404186f8b65ffe8253f92fcc43fadde0ffa Mon Sep 17 00:00:00 2001 From: Stephan Bergmann <sberg...@redhat.com> Date: Mon, 2 Aug 2021 14:17:00 +0200 Subject: [PATCH] Avoid division by zero for empty elliptical arc
...as seen when using libodfgen in LibreOffice, running under UBSan `instdir/program/soffice --headless --convert-to epub` of caolan/libmspub_icu_global_buffer_overflow.sample from the LibreOffice crash- testing corpus (see <https://git.libreoffice.org/core/+/fa759359587808f5e74217e558ee3dd9143710f7%5E%21> "external/libodfgen: Avoid division by zero for empty elliptical arc"). --- src/GraphicFunctions.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/GraphicFunctions.cxx b/src/GraphicFunctions.cxx index 38be852..87e530b 100644 --- a/src/GraphicFunctions.cxx +++ b/src/GraphicFunctions.cxx @@ -59,6 +59,10 @@ void getEllipticalArcBBox(double x0, double y0, 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; -- 2.31.1
_______________________________________________ Libwpd-devel mailing list Libwpd-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libwpd-devel