Skip to content

Commit

Permalink
Merge pull request #1758 from KLayout/bugfix/issue-1757
Browse files Browse the repository at this point in the history
Fixed issue 1757 (Triangles::clear () use-after-free) plus another un…
  • Loading branch information
klayoutmatthias authored Jul 1, 2024
2 parents 564861a + 7397b8e commit 6a38683
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/db/db/dbTriangles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace db
{

Triangles::Triangles ()
: m_is_constrained (false), m_level (0), m_flips (0), m_hops (0)
: m_is_constrained (false), m_level (0), m_id (0), m_flips (0), m_hops (0)
{
// .. nothing yet ..
}
Expand Down Expand Up @@ -1414,8 +1414,8 @@ Triangles::remove_outside_triangles ()
void
Triangles::clear ()
{
m_edges_heap.clear ();
mp_triangles.clear ();
m_edges_heap.clear ();
m_vertex_heap.clear ();
m_returned_edges.clear ();
m_is_constrained = false;
Expand Down
7 changes: 7 additions & 0 deletions src/db/unit_tests/dbTrianglesTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ TEST(basic)
EXPECT_EQ (tris.to_string (), "((1, 0), (1, 4), (5, 0)), ((1, 4), (5, 4), (5, 0))");

EXPECT_EQ (tris.check (), true);

tris.clear ();

EXPECT_EQ (tris.bbox ().to_string (), "()");
EXPECT_EQ (tris.to_string (), "");

EXPECT_EQ (tris.check (), true);
}

TEST(flip)
Expand Down

0 comments on commit 6a38683

Please sign in to comment.