mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-04 02:38:05 -05:00
Fix Stack Overflow When Nesting Clipper2 Results With Cyclic Splits (#17592)
Backport PolyClipping/Clipper2 f97d65d. CheckSplitOwner descended into an emptied OutRec's splits without the recursive_split guard, so emptied OutRecs that referred to each other recursed until the stack overflowed. Fixes #17584
This commit is contained in:
1 parent
ced396fedc
commit
49b84637ee
2 files changed
+16
-2
No files matched your search
@@ -2978,8 +2978,14 @@ namespace Clipper2Lib {
|
||||
for (size_t idx = 0; idx < splits->size(); ++idx)
|
||||
{
|
||||
OutRec* split = (*splits)[idx];
|
||||
if (!split->pts && split->splits &&
|
||||
CheckSplitOwner(outrec, split->splits)) return true; //#942
|
||||
if (!split->pts && split->splits)
|
||||
{
|
||||
if (split->recursive_split == outrec) continue;
|
||||
split->recursive_split = outrec; // emptied OutRecs can reference each other
|
||||
|
||||
if (CheckSplitOwner(outrec, split->splits)) return true; //#942
|
||||
}
|
||||
|
||||
split = GetRealOutRec(split);
|
||||
if (!split || split == outrec || split->recursive_split == outrec) continue;
|
||||
split->recursive_split = outrec; // prevent infinite loops
|
||||
|
||||
Reference in new issue
Block a user