From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: remove contrib/xml2 |
Date: | 2010-02-03 13:49:11 |
Message-ID: | 20100203134911.GB3905@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Robert Haas escribió:
> On Mon, Feb 1, 2010 at 5:23 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> > Robert Haas wrote:
> >> (2) add a very, very large warning that this will crash if you do
> >> almost anything with it.
> >
> > I think that's an exaggeration. Certain people are known to be using it
> > quite successfully.
>
> Hmm. Well, all I know is that the first thing I tried crashed the server.
>
> CREATE TABLE xpath_test (id integer NOT NULL, t xml);
> INSERT INTO xpath_test VALUES (1, '<doc><int>1</int></doc>');
> SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true')
> as t(id int4);
This trivial patch lingering on my system fixes this crasher (this is
for the 8.3 branch). It makes the "problem in alloc set ExprContext"
warning show up instead.
There are still lotsa other holes, but hey, this is a start ...
Index: contrib/xml2/xpath.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/contrib/xml2/xpath.c,v
retrieving revision 1.16.2.1
diff -c -p -r1.16.2.1 xpath.c
*** contrib/xml2/xpath.c 26 Mar 2008 01:19:11 -0000 1.16.2.1
--- contrib/xml2/xpath.c 27 Jan 2010 15:30:56 -0000
*************** xpath_table(PG_FUNCTION_ARGS)
*** 793,798 ****
--- 793,801 ----
*/
pgxml_parser_init();
+ PG_TRY();
+ {
+
/* For each row i.e. document returned from SPI */
for (i = 0; i < proc; i++)
{
*************** xpath_table(PG_FUNCTION_ARGS)
*** 929,934 ****
--- 932,944 ----
if (xmldoc)
pfree(xmldoc);
}
+ }
+ PG_CATCH();
+ {
+ xmlCleanupParser();
+ PG_RE_THROW();
+ }
+ PG_END_TRY();
xmlCleanupParser();
/* Needed to flag completeness in 7.3.1. 7.4 defines it as a no-op. */
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Meskes | 2010-02-03 13:57:19 | Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors |
Previous Message | Robert Haas | 2010-02-03 13:48:12 | Re: [CFReview] Red-Black Tree |