Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: skgsergio(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2
Date: 2019-02-08 17:53:48
Message-ID: 32330.1549648428@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> Although libxml2 tries not to return a null message but both their xmlStrdup
> function and XML_GET_VAR_STR can return null in a OOM scenario.

Ugh.

> - appendStringInfoString(errorBuf, error->message);
> + if (error->message != NULL)
> + appendStringInfoString(errorBuf, error->message);

I'm inclined to do something more like

+ if (error->message != NULL)
+ appendStringInfoString(errorBuf, error->message);
+ else
+ appendStringInfoString(errorBuf, "(no message provided)");

else the output will read very oddly in this situation.

Thanks for the report!

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sergio Conde Gómez 2019-02-08 18:00:46 Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2
Previous Message PG Bug reporting form 2019-02-08 11:29:32 BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2