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

From Sergio Conde Gómez
Subject Re: BUG #15624: Sefgault when xml_errorHandler receives a nullerror->message from libxml2
Date
Msg-id CAGjK+HS2AttYru-M7-O3-0ga0hhBAi2tq8idzm6p8tp7W+RK1g@mail.gmail.com
Whole thread Raw
In response to Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Yes, you are right. Didn't really checked the full output so it makes sense to do that to be consistent as almost always there will be a message. Thanks!

El vie., 8 feb. 2019 a las 18:53, Tom Lane (<tgl@sss.pgh.pa.us>) escribió:
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


--
Sergio Conde
GPG Key: 0x1867A20A
Fingerprint: 487D 62C8 523C 9BBF 7CC8 D029 959E A15D 1867 A20A
http://keybase.io/skgsergio

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2
Next
From: Tom Lane
Date:
Subject: Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2