W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1999

bugfix

From: Raffaele Sena <raff@nuvomedia.com>
Date: Mon, 29 Nov 1999 18:14:35 -0800
Message-ID: <001601bf3ad9$19f89920$52c0a8c0@nuvomedia.com>
To: "libwww" <www-lib@w3.org>
Hi,

I found a subtle bug in SGML.c. Not sure why I didn't see it before.

In a sequence '<TD>something\n\t\</TD>' I got a first call to SGML_write
terminating at the newline.
This leaves the SGML state set to S_nl.

On the next SGML_write I see the processing of the tab character going through
the S_nl switch case,
incrementing the count variable and then jumping to S_text. In there the
character is not a special
case and so it will cause the count variable to be incremented again.

Next character, the '<' goes into S_text again, and at this point output the
saved characters,
before changing the state into S_tag. The only character that should be passed
through is the
tab, but the count is now 2 and the following '<' is sent to the HTML parser
(and printed out,
in my application).

It looks to me that the S_nl switch case shouldn't increment count, but go
straight to S_text,
so that the counter is 1 and only the tab character is then sent out.

Am I missing something ? I tried the following patch and it seems to work, in
my specific
case. I'll do some more testing and if they are fine and nobody else complains
:) I will
check this change in.

Thanks,

    Raffaele


Index: SGML.c
===================================================================
RCS file: /sources/public/libwww/Library/src/SGML.c,v
retrieving revision 1.53
diff -r1.53 SGML.c
366,367d365
<                           {
<                               ++count;
369d366
<                           }

-----------------------------------------------------------------
Raffaele Sena
Nuvomedia, Inc.
Received on Monday, 29 November 1999 21:17:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:35 GMT