Skip to content

Commit cc36ccc

Browse files
committed
Fix uninitialized memory read
1 parent 7ee8173 commit cc36ccc

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

CPP/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ if (NOT (CLIPPER2_USINGZ STREQUAL "ONLY"))
8080
if (MSVC)
8181
target_compile_options(Clipper2 PRIVATE /W4 /WX)
8282
else()
83-
target_compile_options(Clipper2 PRIVATE -Wall -Wextra -Wpedantic -Werror)
83+
target_compile_options(Clipper2 PRIVATE -Wall -Wextra -Wpedantic -Werror -Werror=uninitialized)
8484
target_link_libraries(Clipper2 PUBLIC -lm)
8585
endif()
8686
endif()
@@ -105,7 +105,7 @@ if (NOT (CLIPPER2_USINGZ STREQUAL "OFF"))
105105
if (MSVC)
106106
target_compile_options(Clipper2Z PRIVATE /W4 /WX)
107107
else()
108-
target_compile_options(Clipper2Z PRIVATE -Wall -Wextra -Wpedantic -Werror)
108+
target_compile_options(Clipper2Z PRIVATE -Wall -Wextra -Wpedantic -Werror -Werror=uninitialized)
109109
target_link_libraries(Clipper2Z PUBLIC -lm)
110110
endif()
111111
endif()

CPP/Clipper2Lib/src/clipper.triangulation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ namespace Clipper2Lib
12021202

12031203
TriangulateResult Triangulate(const PathsD& pp, int decPlaces, PathsD& solution, bool useDelaunay)
12041204
{
1205-
int ec;
1205+
int ec = 0;
12061206
double scale;
12071207
TriangulateResult result;
12081208
if (decPlaces <= 0) scale = 1;

CPP/Examples/Inflate/Inflate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void DoSimpleShapes()
8686
// POLYGON JOINTYPES SVG:
8787

8888
// 1. triangle offset - with large miter
89-
int err, scale = 100;
89+
int err = 0, scale = 100;
9090
PathsD p, solution;
9191
p.push_back(MakePathD({ 30,150, 60,350, 0,350 }));
9292
solution.insert(solution.end(), p.begin(), p.end());

CPP/Tests/TestOffsets.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ TEST(Clipper2Tests, TestOffsets2) { // see #448 & #456
4646
Paths64 subject, solution;
4747
ClipperOffset c;
4848
subject.push_back(MakePath({ 50,50, 100,50, 100,150, 50,150, 0,100 }));
49-
int err;
49+
int err = 0;
5050
subject = ScalePaths<int64_t, int64_t>(subject, scale, err);
5151
c.AddPaths(subject, JoinType::Round, EndType::Polygon);
5252
c.ArcTolerance(arc_tol);

0 commit comments

Comments
 (0)