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

From: Sergio Conde Gómez <skgsergio(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 18:00:46
Message-ID: CAGjK+HS2AttYru-M7-O3-0ga0hhBAi2tq8idzm6p8tp7W+RK1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)us>) escribió:

> 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
>

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-02-08 18:32:37 Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2
Previous Message Tom Lane 2019-02-08 17:53:48 Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2