Skip to content

Commit

Permalink
Update TriangulateCDT.h
Browse files Browse the repository at this point in the history
In FillRegion, accessing tkey from the front of regionQueue using a const reference is incorrect, because the next line of code is a pop of the queue which invalidates the memory, corrupting the value of tkey. A copy must be made of the front of the queue. Thanks to Aaron Barony for tracking down the problem.
  • Loading branch information
davideberly committed Nov 2, 2021
1 parent 0c097fd commit b51c7fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GTE/Mathematics/TriangulateCDT.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
// https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
// Version: 4.0.2021.04.22
// Version: 4.0.2021.11.02

#pragma once

Expand Down Expand Up @@ -988,7 +988,7 @@ namespace gte
auto const& tmap = graph.GetTriangles();
while (regionQueue.size() > 0)
{
auto const& tkey = regionQueue.front();
TriangleKey<true> tkey = regionQueue.front();
regionQueue.pop();
auto titer = tmap.find(tkey);
LogAssert(titer != tmap.end(), "Unexpected condition.");
Expand Down

0 comments on commit b51c7fb

Please sign in to comment.