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

[BUG+FIX] Problem in parser.TrimInitialSpace

From: Gary L Peskin <garyp@firstech.com>
Date: Tue, 31 Oct 2000 15:47:10 -0800
Message-ID: <39FF59FE.D1312A5F@firstech.com>
To: Html-Tidy <html-tidy@w3.org>
This routine does not check to see if the space it's trimming is
actually part of the node from which it's trimming the space.  This
results in a situation where node.start is greater than node.end.  This
causes negative subscript errors in clone() and other bad things.

To fix:

Change line 326 from:

    if (text->type == TextNode && lexer->lexbuf[text->start] == ' ')

to:

    if (text->type == TextNode && lexer->lexbug[text->start] == ' '
                               && text->start < text->end)

Gary
Received on Tuesday, 31 October 2000 18:47:09 GMT

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