Re: BUG #3675: Crash on xpath function with 2 parameters

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Jeremy Palmer <jpalmer(at)linz(dot)govt(dot)nz>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3675: Crash on xpath function with 2 parameters
Date: 2007-10-13 20:50:25
Message-ID: 28532.1192308625@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Kris Jurka <books(at)ejurka(dot)com> writes:
> On Sat, 13 Oct 2007, Jeremy Palmer wrote:
>> The following query crashes the backend:
>>
>> SELECT xpath('/my:a/text()', '<my:a
>> xmlns:my="http://example.com">test</my:a>');
>>
> This patch avoids the double free of xpathcomp and fixes things for me.

Hmm, I wonder why that doesn't crash here? It certainly looks pretty
broken --- maybe some versions of libxml have internal defenses against
this.

Patch applied, and I also cleaned up some other places where an error
escape might possibly lead to double free. (The other ones are probably
not real risks, since libxml presumably doesn't elog, but we might as
well try to make the code bulletproof in case more PG-aware code gets
inserted in these paths.)

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sergey Litvinenko 2007-10-14 21:05:05 pg_dump and password required
Previous Message Kris Jurka 2007-10-13 17:28:55 Re: BUG #3675: Crash on xpath function with 2 parameters