Re: BUG #3675: Crash on xpath function with 2 parameters - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #3675: Crash on xpath function with 2 parameters
Date
Msg-id 28532.1192308625@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #3675: Crash on xpath function with 2 parameters  (Kris Jurka <books@ejurka.com>)
List pgsql-bugs
Kris Jurka <books@ejurka.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

pgsql-bugs by date:

Previous
From: Kris Jurka
Date:
Subject: Re: BUG #3675: Crash on xpath function with 2 parameters
Next
From: Sergey Litvinenko
Date:
Subject: pg_dump and password required