Skip to content

Commit fd0ccb2

Browse files
committed
Bad, repeated node iteration! closes #459
1 parent 92a8722 commit fd0ccb2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/parser.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -3851,7 +3851,15 @@ Bool TY_(FindNodeWithId)( Node *node, TidyTagId tid )
38513851
{
38523852
if (TagIsId(node,tid))
38533853
return yes;
3854-
for (content = node->content; content; content = content->content)
3854+
/*\
3855+
* Issue #459 - Under certain circumstances, with many node this use of
3856+
* 'for (content = node->content; content; content = content->content)'
3857+
* would produce a **forever** circle, or at least a very extended loop...
3858+
* It is sufficient to test the content, if it exists,
3859+
* to quickly iterate all nodes. Now all nodes are tested only once.
3860+
\*/
3861+
content = node->content;
3862+
if (content)
38553863
{
38563864
if (TY_(FindNodeWithId)(content,tid))
38573865
return yes;

version.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
5.3.11
2-
2016.09.11
1+
5.3.12
2+
2016.10.14

0 commit comments

Comments
 (0)