Re: PG crash on simple query, story continues

From: "Maksim Likharev" <mlikharev(at)aurigin(dot)com>
To: <pgsql-general(at)postgresql(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PG crash on simple query, story continues
Date: 2003-07-11 23:12:30
Message-ID: 56510AAEF435D240958D1CE8C6B1770A016D2DB0@mailc03.aurigin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

So following modification seems to fixed all PG (7.3/7.3.3)crashes on
Solaris ( NON C LOCALE )

selfuncs.c line 2356:

I changed:
xfrmsize = strlen(val) + 32; /*arbitrary pad value here...*/
to
xfrmsize = strxfrm(NULL, val, 0) + 32;

so basically instead of wild guess of transformed string size I asking
"strxfrm" for that.

+32 out my desperation, strxfrm(NULL, val, 0) + 1 should be fine ( have
not tested that )...

Out of curiosity:
Really interesting, following condition seems to be impossible anymore,
of cause if something went terribly wrong,

die here, return original string, return empty string?

if (xfrmlen >= xfrmsize) {
pfree(xfrmstr);
xfrmstr = (char *) palloc(xfrmlen + 1);
xfrmlen = strxfrm(xfrmstr, val, xfrmlen + 1);
}

Again fixed all crashes on Sun 5.8 ( PG 7.3.3, en_US locale, LATIN1
encoding ) Generic Patch...

P.S
NO SUPPORT, NO WARRANTY, NO NOTHING, just for you information.

Regards.

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Tuesday, July 08, 2003 3:58 PM
To: Maksim Likharev
Cc: pgsql-general(at)postgresql(dot)org; pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] PG crash on simple query, story continues

"Maksim Likharev" <mlikharev(at)aurigin(dot)com> writes:
> On failure, strxfrm() returns (size_t)-1.

Not according to the Single Unix Specification, Linux, or HP-UX;
I don't have any others to check. But anyway, that is not causing
your problem, since palloc(0) would complain not dump core.

> I am on SunOS 5.8,

Solaris, eh? IIRC, it was Solaris that we last heard about broken
strxfrm on. Better check to see if Sun has a fix for this.

regards, tom lane

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-07-11 23:45:20 Re: corrupt data
Previous Message Justin Tocci 2003-07-11 14:46:03 Complex rules and working with MS Access: SOLVED

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-07-12 00:32:55 Re: btree fast-root on VACUUM FULL
Previous Message Alvaro Herrera 2003-07-11 19:37:28 btree fast-root on VACUUM FULL