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

Re: Yet another table related bug

From: Terry Teague <teague@mailandnews.com>
Date: Fri, 29 Oct 1999 19:22:29 -0700
Message-Id: <l03130300b4400388850d@[17.219.108.16]>
To: html-tidy@w3.org
At 7:29 AM -0400 10/29/99, Todd M. Lewis wrote:
>Jussi Vestman wrote:
>>
>> On Thu, 28 Oct 1999, Terry Teague wrote:
>>
>> > As an FYI, I ran the above code through the Mac OS version of Tidy (22 Oct
>> > 99), and it produced the following without crashing (that's not to say
>> > there isn't a bug there).
>>
>> That is interesting. I run same version of tidy on Linux platform
>> and it crashes. I shoud have included error messages as you did:
>>
>> > MacTidy (vers 19th October 1999) Parsing "Work:FilterTop:Filter
>> > line 9 column 1 - Warning: <hr> isn't allowed in <> elements
>>
>> Tidy (vers 19th October 1999) Parsing "koe4.html"
>> line 9 column 1 - Warning: <hr> isn't allowed in <(null)> elements
>>
>> HR -element seems to have null value at its parent pointer. The MacOs
>> version doesn't seem to know its parent either, but it doesn't
>> crash.
>
>I don't know what you mean by "crash", but it looks like both programs
>ran to completion. They didn't do the useful thing you wanted, but
>that's another issue.
>

OK, when Jussi said "crash", I assumed he didn't get output, and the
program was abnormally terminated. I offered the output from the Mac OS
version as an indication of what the output might be had the program not
"crashed".

>As for the difference between "<>" and "<(null)>", that's just a
>difference in the implementation of the C I/O library. When printf() and
>friends are passed a NULL pointer to what's supposed to be a string, the
>Linux version prints out the text "(null)", while the Mac version prints
>nothing. I don't know what the ANSI C standard says is the Right Thing
>to do here, but I suspect it's either "undefined" or "implementation
>specific".

Right. K&R doesn't say anything.

>Otherwise, it looks like both Mac and UNIX versions do exactly the same
>thing.
>
>> What differences are there between Mac and Unix-source? Does MacOS version
>> have some patches that are not present in Unix version?

There are a couple of minor differences from the "base" code that I don't
think pertain to the discussion at hand, but here is one change in
"attrs.c" :

void CheckUrl(Lexer *lexer, Node *node, AttVal *attval)
{
    char c, *p = attval->value;

    if (FixBackslash && p)	/* Fix crash on null URL attribute value -
Andy Quick  - 17 Jul 99 */
    {
        while (c = *p)
        {
            if (c =='\\')
                *p = '/';

            ++p;
        }
    }
}


As for how Mac OS handles de-referencing a "null" pointer, as compared to
some other OS's - since the current Mac OS does not use protected memory,
de-referencing a "null" pointer may or may not cause a crash (it is likely
to cause an unexpected result) - so far in examples of bugs in tidy that
others have provided, where their OS gets a segment violation or other, the
Mac OS version has usually survived, or got stuck in a (infinite recursion)
loop in the parser/lexer, and when it is apparent this is happening, the
execution can be aborted before there is a stack overflow etc.

Regards, Terry
Received on Friday, 29 October 1999 22:23:24 GMT

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