Обсуждение: BUG #4912: server core dumps on xslt_process with empty param string

Поиск
Список
Период
Сортировка

BUG #4912: server core dumps on xslt_process with empty param string

От
"Tom Bowden"
Дата:
The following bug has been logged online:

Bug reference:      4912
Logged by:          Tom Bowden
Email address:      tom.bowden@fis-cal.com
PostgreSQL version: 8.4rc2
Operating system:   Linux 2.6.22.5-31-bigsmp
Description:        server core dumps on xslt_process with empty param
string
Details:

I found that when using xslt_process(), either with two parameters, or with
an empty/null third parameter -- that I get a 'server restarted' message.

To stop this behavior, I changed the source code in contrib/xml2/xslt_proc.c
(around line 142) .. adding the following:
if ( pstr == NULL ||  strlen(pstr) < 1 ) {
          params[0] = NULL;
          return;
}


I don't know if this is the right place to report this; whether there is a
better way (or not) to fix it,(add any other disclaimers you might want to
add - or tell me where you want me to go with this :).


Tom

Re: BUG #4912: server core dumps on xslt_process with empty param string

От
Tom Lane
Дата:
"Tom Bowden" <tom.bowden@fis-cal.com> writes:
> I found that when using xslt_process(), either with two parameters, or with
> an empty/null third parameter -- that I get a 'server restarted' message.

Hm, I don't.

regression=# select xslt_process('<a/>','<b/>');
 xslt_process
--------------

(1 row)

regression=# select xslt_process('<a/>','<b/>', '');
 xslt_process
--------------

(1 row)

> To stop this behavior, I changed the source code in contrib/xml2/xslt_proc.c
> (around line 142) .. adding the following:
> if ( pstr == NULL ||  strlen(pstr) < 1 ) {
>           params[0] = NULL;
>           return;
> }

I can't see that this would fix anything.  A NULL value there is
impossible, and if the string is empty, the loop below should fall out
after properly setting param[0] to NULL.  It does look a bit
questionable whether the code does the right thing when MAXPARAMS gets
overrun, but I'm really not seeing what you're seeing.  Are you sure
you are using 8.4 and an 8.4 version of xml2?

            regards, tom lane