Re: recent --with-libxml support

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeremy Drake <pgsql(at)jdrake(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: recent --with-libxml support
Date: 2006-12-24 01:22:40
Message-ID: 21235.1166923360@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeremy Drake <pgsql(at)jdrake(dot)com> writes:
> On Fri, 22 Dec 2006, Tom Lane wrote:
>> Jeremy Drake <pgsql(at)jdrake(dot)com> writes:
>>> As seen, I needed to add an include dir for configure to pass. However,
>>> make check fails now with the backend crashing. This can be seen in the
>>> buildfarm results for mongoose.
>>
>> Can you provide a stack trace for that crash?

> #0 0xb7c4dc85 in memcpy () from /lib/tls/libc.so.6
> #1 0x08190f59 in appendBinaryStringInfo (str=0xbfd87f90,
> data=0x841ffc0 "qux", datalen=138543040) at stringinfo.c:192
> #2 0x0828377f in map_sql_identifier_to_xml_name (ident=0x841ffc0 "qux",
> fully_escaped=0 '\0') at xml.c:933
> #3 0x0811ce83 in transformXmlExpr (pstate=0x84202b8, x=0x8420034)
> at parse_expr.c:1426
> #4 0x0811ac91 in transformExpr (pstate=0x84202b8, expr=0x8420034)
> at parse_expr.c:238

Ah-hah, I've sussed it. sqlchar_to_unicode() calls the
mb2wchar_with_len converters, which are defined to return a *null
terminated* pg_wchar string. So even if you only ask for the conversion
of a single character, you need a 2-pg_wchar array to hold the result,
and that wasn't being allocated. So the code was clobbering a word of
stack space that evidently is critical on some machines and not others.

Fix committed, please see if it works for you now.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-12-24 01:44:59 Loose ends in PG XML patch
Previous Message Andrew Dunstan 2006-12-23 17:36:04 Re: libxml on unixware