Bug: Infinite loop in ParseList() (again)

Thanks to Dave Raggett, the bug which I reported is now fixed.

But There are a few more cases which causes infinite loop
in the newest version of tidy.
----
Example 1.

<html>
<head><title>Loop 1</title></head>
<body>
<ol>
<font color="red"><li>Item 1</li></font>
<font color="green"><li>Item 2</li></font>
</ol>
</body>
</html>
----
Example 2. (This is what Björn Höhrmann reported.)

<html>
<head><title>Loop 2</title></head>
<body>
<ol>
<ul>
</ol>
</body>
</html>
----

I attach a quick patch for this problem.
I hope it doesn't affect anything else.

Regards,
-- 
Kenichi Numata
IT Business Development Dept., Fuji Xerox Co., Ltd.
E-Mail: Kenichi.Numata@fujixerox.co.jp
*** tidy27sep99\parser.c	Mon Sep 27 10:15:50 1999
--- parser.c	Fri Oct 01 14:40:42 1999
***************
*** 651,657 ****
                          return;
                      }
  
!                     node = InferredTag(lexer, "ul");
                  }
                  else if (node->tag->model & CM_DEFLIST)
                  {
--- 651,660 ----
                          return;
                      }
  
!                     if (element->was)
!                         node = InferredTag(lexer, element->was->name);
!                     else
!                         node = InferredTag(lexer, "ul");
                  }
                  else if (node->tag->model & CM_DEFLIST)
                  {
***************
*** 1399,1404 ****
--- 1402,1414 ----
                      TrimEmptyElement(lexer, list);
                      return;
                  }
+             }
+ 
+             if (node->tag && node->tag->model & CM_BLOCK)
+             {
+                 ReportWarning(lexer, list, node, DISCARDING_UNEXPECTED);
+                 FreeNode(node);
+                 continue;
              }
          }
  

Received on Friday, 1 October 1999 02:19:08 UTC