W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 1999

Bug: Infinite loop in ParseList() (again)

From: Kenichi Numata <Kenichi.Numata@fujixerox.co.jp>
Date: Fri, 01 Oct 1999 15:18:55 +0900
Message-ID: <37F4524F.D8D8A4C2@fujixerox.co.jp>
To: html-tidy@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:42 GMT