W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2000

Infinite loop fix for <noframes><frame></noframe>

From: Kyle Kartchner <kylek@mycomputer.com>
Date: Sun, 25 Jun 2000 15:09:00 -0600
Message-ID: <395674EC.EA220A75@mycomputer.com>
To: html-tidy@w3.org
First off Dave, I want to commend your excellent organization of code,
and structure.  I'm very impressed with how thought out, and how nicely
designed it is.  I am coding a daemon that will use tidy's parser, and I
found that your data structure was very easy to traverse, so I grabbed

In being that my program is a daemon, I can't afford any infinite
loops.  In parsing a user's site I found an infinite loop that was
caused by the parser.c ParseNoFrames() function.  It would would cause a
loop on the following HTML snippet:

<body bgcolor="#000000" text="#ffffff">
<h1>Need a Frame Capable Browser!</h1>
<frame src="title.html" name="p1" scrolling=no>

This is obviously a poorly written piece of html code, and I'm sure a
very rare occurance which is why I'm sure Dave did not find it.  I'm not
sure that this is how Dave would want to handle this code, but I have a
fix (without the warning because I don't use them) below:

Old code -
2891-        if ((node->tag == tag_frame || node->tag == tag_frameset))
2892-        {
2893-            ReportWarning(lexer, noframes, node,
2894-            TrimSpaces(lexer, noframes);
2895-            UngetToken(lexer);
2896-            return;
2897-        }

Fixed code -
2891-        if (node->tag == tag_frameset)
2892-        {
2893-        {
2894-            ReportWarning(lexer, noframes, node,
2895-            TrimSpaces(lexer, noframes);
2896-            UngetToken(lexer);
2897-            return;
2898-        }
2900-        if (node->tag == tag_frame)
2901-        {
2902-            // Didn't worry about a warning message here, but it
should have one. Just discard tag.
2903-            // Kyle Kartchner
2904-            FreeNode(node);
2905-            continue;
2906-        }


Kyle Kartchner
Software Engineer
tools to power your eBusiness
Received on Sunday, 25 June 2000 17:13:57 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:48 UTC