Re: segfault at aset.c:539 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: segfault at aset.c:539
Date
Msg-id 2258.1058201365@sss.pgh.pa.us
Whole thread Raw
In response to segfault at aset.c:539  (Tomas Szepe <szepe@pinerecords.com>)
Responses Re: segfault at aset.c:539  (Tomas Szepe <szepe@pinerecords.com>)
List pgsql-bugs
Tomas Szepe <szepe@pinerecords.com> writes:
> I'm getting an ugly non-deterministic segfault in postmaster
> at aset.c:539.
> ...
> Anyone with a fix? :)

Yech.  This is the *second* buffer-overrun bug we've found in to_ascii()
in the last couple months.  I've now taken a close look at that whole
file and I think the rest of it is okay, but ... :-(

Patch against 7.3.3 is attached.

            regards, tom lane

*** src/backend/utils/adt/ascii.c.orig    Wed Apr  2 16:08:07 2003
--- src/backend/utils/adt/ascii.c    Mon Jul 14 12:37:33 2003
***************
*** 94,100 ****
  {
      pg_to_ascii(
                  (unsigned char *) VARDATA(data),        /* src */
!                 VARDATA(data) + VARSIZE(data),    /* src end */
                  (unsigned char *) VARDATA(data),        /* desc */
                  enc);            /* encoding */

--- 94,100 ----
  {
      pg_to_ascii(
                  (unsigned char *) VARDATA(data),        /* src */
!                 (unsigned char *) (data) + VARSIZE(data),    /* src end */
                  (unsigned char *) VARDATA(data),        /* desc */
                  enc);            /* encoding */

pgsql-bugs by date:

Previous
From: Tomas Szepe
Date:
Subject: Re: segfault at aset.c:539
Next
From: Tomas Szepe
Date:
Subject: Re: segfault at aset.c:539