Skip to content

Commit 086a1c2

Browse files
committed
BUG: fix an infinite loop in itk::VoronoiDiagram2DGenerator
The loop exit condition was present in the code, but never wired and removed via cd97879 Fixes #4386
1 parent 21349b7 commit 086a1c2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2DGenerator.hxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,10 @@ VoronoiDiagram2DGenerator<TCoordinate>::ConstructDiagram()
274274
buildEdges.push_back(curr);
275275
EdgeInfo front = curr;
276276
EdgeInfo back = curr;
277-
while (!(rawEdges[i].empty()))
277+
auto maxStop = static_cast<int>(rawEdges[i].size());
278+
while (!(rawEdges[i].empty()) && (maxStop > 0))
278279
{
280+
--maxStop;
279281
curr = rawEdges[i].front();
280282
rawEdges[i].pop_front();
281283
unsigned char frontbnd = Pointonbnd(front[0]);

0 commit comments

Comments
 (0)