Skip to content

Commit

Permalink
avoid stack overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Nov 22, 2024
1 parent 4c287f2 commit 99bb50d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2024-11-22 Richard Frith-Macdonald <[email protected]>

* Tools/AGSIndex: (-makeRefs:) process child nodes in loop rather
than recursively ... reduces the depth of recursion to the depth of
nesting children rather than the number of children, avoiding stack
overflow for large projects.

2024-11-21 Richard Frith-Macdonald <[email protected]>

* NSRegularExpression: avoid leaks in ICU code by calling more
Expand Down
8 changes: 2 additions & 6 deletions Tools/AGSIndex.m
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ - (id) init
- (void) makeRefs: (GSXMLNode*)node
{
GSXMLNode *children = [node firstChild];
GSXMLNode *next = [node next];
BOOL newUnit = NO;

if ([node type] == XML_ELEMENT_NODE)
Expand Down Expand Up @@ -541,20 +540,17 @@ - (void) makeRefs: (GSXMLNode*)node
}
}

if (children != nil)
while (children)
{
[self makeRefs: children];
children = [children next];
}
if (newUnit == YES)
{
unit = nil;
category = nil;
classname = nil;
}
if (next != nil)
{
[self makeRefs: next];
}
}

/**
Expand Down

0 comments on commit 99bb50d

Please sign in to comment.