From c7f820f6a03fa91f189b866d27bf40dfe47abaa6 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 11 Jan 2026 10:12:05 -0500 Subject: [PATCH] Fix uninitialized memory read --- CPP/Clipper2Lib/src/clipper.triangulation.cpp | 2 +- CPP/Examples/Inflate/Inflate.cpp | 2 +- CPP/Tests/TestOffsets.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CPP/Clipper2Lib/src/clipper.triangulation.cpp b/CPP/Clipper2Lib/src/clipper.triangulation.cpp index 4345293f..21b0a6d3 100644 --- a/CPP/Clipper2Lib/src/clipper.triangulation.cpp +++ b/CPP/Clipper2Lib/src/clipper.triangulation.cpp @@ -1202,7 +1202,7 @@ namespace Clipper2Lib TriangulateResult Triangulate(const PathsD& pp, int decPlaces, PathsD& solution, bool useDelaunay) { - int ec; + int ec = 0; double scale; TriangulateResult result; if (decPlaces <= 0) scale = 1; diff --git a/CPP/Examples/Inflate/Inflate.cpp b/CPP/Examples/Inflate/Inflate.cpp index f63551c0..5e06096a 100644 --- a/CPP/Examples/Inflate/Inflate.cpp +++ b/CPP/Examples/Inflate/Inflate.cpp @@ -86,7 +86,7 @@ static void DoSimpleShapes() // POLYGON JOINTYPES SVG: // 1. triangle offset - with large miter - int err, scale = 100; + int err = 0, scale = 100; PathsD p, solution; p.push_back(MakePathD({ 30,150, 60,350, 0,350 })); solution.insert(solution.end(), p.begin(), p.end()); diff --git a/CPP/Tests/TestOffsets.cpp b/CPP/Tests/TestOffsets.cpp index 365ad937..5fbb3754 100644 --- a/CPP/Tests/TestOffsets.cpp +++ b/CPP/Tests/TestOffsets.cpp @@ -46,7 +46,7 @@ TEST(Clipper2Tests, TestOffsets2) { // see #448 & #456 Paths64 subject, solution; ClipperOffset c; subject.push_back(MakePath({ 50,50, 100,50, 100,150, 50,150, 0,100 })); - int err; + int err = 0; subject = ScalePaths(subject, scale, err); c.AddPaths(subject, JoinType::Round, EndType::Polygon); c.ArcTolerance(arc_tol);