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

New commits:
commit b6db71d04fa041623482779afa4c38b747f9ce6a
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:31:52 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/+/189642
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/emfio/source/reader/emfreader.cxx 
b/emfio/source/reader/emfreader.cxx
index 7a7b2a370377..6cb0e8067972 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1378,9 +1378,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 f4bae3abb277..e6e50e259df8 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -346,6 +346,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