emfio/source/reader/emfreader.cxx |   13 ++++++++++---
 tools/source/generic/poly.cxx     |    3 +++
 2 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 6d3da3fa0146710e6f816df1ef7c787967f3b8bf
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Aug 14 20:59:17 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Aug 15 09:32:04 2025 +0200

    ofz#437531730 Segv on unknown address
    
    since:
    
    commit 1b68f859034ecc2342a772685d6563fa1ad71f7f
    Date:   Sun Aug 3 01:01:38 2025 +0200
    
        tdf#167616 EMF Add support for EMR_ANGLEARC record
    
    nPoints can be 0 here
    
    Change-Id: If9aa60e8abbf5e58f5224fe62b84163fbae55448
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189643
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/emfio/source/reader/emfreader.cxx 
b/emfio/source/reader/emfreader.cxx
index 037d01ea39c2..307a4fdb5cdb 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1377,9 +1377,16 @@ namespace emfio
 
                             tools::Polygon aPoly(Point(nCenterX, nCenterY), 
nRadius, fStartAngle, fSweepAngle, IsArcDirectionClockWise());
 
-                            // Before drawing the arc, AngleArc draws the line 
segment from the current position to the beginning of the arc
-                            LineTo(aPoly[0], mbRecordPath);
-                            DrawPolyLine(std::move(aPoly), true, mbRecordPath);
+                            if (!aPoly.GetSize())
+                            {
+                                SAL_WARN("emfio", "EMF file error: 0 points");
+                            }
+                            else
+                            {
+                                // Before drawing the arc, AngleArc draws the 
line segment from the current position to the beginning of the arc
+                                LineTo(aPoly[0], mbRecordPath);
+                                DrawPolyLine(std::move(aPoly), true, 
mbRecordPath);
+                            }
                         }
                     }
                     break;
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 376446e0fa20..eb8f4b33a536 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -347,6 +347,9 @@ ImplPolygon::ImplPolygon(const Point& aCenter, const 
sal_uInt32 nRadius, const f
 
     ImplInitSize(nPoints);
 
+    if (!nPoints)
+        return;
+
     for (sal_uInt16 i = 0; i < nPoints; i++, fStart += fStep)
     {
         Point& rPt = mxPointAry[i];

Reply via email to