Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2
Sergio Conde Gómez <skgsergio@gmail.com>
From: Sergio Conde Gómez <skgsergio@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2019-02-08T18:00:46Z
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@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
Commits
-
Defend against null error message reported by libxml2.
- 37f3a7751efb 9.4.21 landed
- 7821a4d60ed6 9.5.16 landed
- ef922faea703 9.6.12 landed
- 0d7d71b64d70 10.7 landed
- 8e2956734b98 11.2 landed
- 0edef16d76be 12.0 landed