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

Bug and (bad ?) fix

From: Bruno Rohee <br@spooky.net>
Date: Wed, 22 Dec 1999 04:10:54 +0100
To: html-tidy@w3.org
Message-ID: <19991222041054.A26177@isildur>
Hi, the file at http://www.openbsd.org/faq/faq8.html
makes tidy core dump (the HTML is not exactly nice...)

The problem occurs in the parser (parser.c), sometimes
node->tag is NULL and there are no checks on this case,
so for example accessing node->tag->model crashs the
program.

My patch add some lacking checks to the program, but my
guess is that the good fix should be to ensure that
node->tag has always a sensible value...

Here's the patch :

--- parser.c.orig       Tue Nov 30 11:44:51 1999
+++ parser.c    Wed Dec 22 03:34:47 1999
@@ -356,6 +356,9 @@
 
 void ParseTag(Lexer *lexer, Node *node, uint mode)
 {
+    if (!node->tag)
+        return;
+
     if (node->tag->model & CM_EMPTY)
     {
         lexer->waswhite = no;
@@ -1435,7 +1438,7 @@
             continue;
         }
 
-        if (node->tag != tag_li)
+        if ((node->tag != tag_li) && node->tag)
         {
             UngetToken(lexer);
 

-- 
Evangelists do it with Him watching.
Received on Tuesday, 21 December 1999 22:12:13 GMT

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