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

From Tom Lane
Subject Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2
Date
Msg-id 32330.1549648428@sss.pgh.pa.us
Whole thread Raw
In response to BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #15624: Sefgault when xml_errorHandler receives a nullerror->message from libxml2  (Sergio Conde Gómez <skgsergio@gmail.com>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.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


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2
Next
From: Sergio Conde Gómez
Date:
Subject: Re: BUG #15624: Sefgault when xml_errorHandler receives a nullerror->message from libxml2