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

Re: Exception: access violation (0xc0000005), Address: 0x004031ec

From: Huajun Zeng <i-hjzeng@microsoft.com>
Date: Thu, 19 Apr 2001 01:48:42 -0400 (EDT)
Message-ID: <F4C77846CEE593418BE5AB7B6A83111E0377F98A@bjs-msg-01.fareast.corp.microsoft.com>
To: <html-tidy@w3.org>
I got the same error when I work with tidy. Then I traced the program,
and found some code may contains bugs.

In function WrapLine in pprint.c:
    if (linelen > wraphere)
        p = linebuf;
        if (linebuf[wraphere] == ' ')
        q = linebuf + wraphere;
        AddC('\0', linelen);
        while ((*p++ = *q++));
        linelen -= wraphere;

The function AddC not only add a char to the buffer, but also can
reallocate mem for linebuf. In this case, p and q point to a memory
block that has been released. The released memory block still can be
accessed, but it is not zero ended. So the while cycle carries the
pointers to some mystic area...
Received on Thursday, 19 April 2001 20:40:32 UTC

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