Skip to content
Snippets Groups Projects
Commit 37f3a775 authored by Tom Lane's avatar Tom Lane
Browse files

Defend against null error message reported by libxml2.

While this isn't really supposed to happen, it can occur in OOM
situations and perhaps others.  Instead of crashing, substitute
"(no message provided)".

I didn't worry about localizing this text, since we aren't
localizing anything else here; besides, if we're on the edge of
OOM, it's unlikely gettext() would work.

Report and fix by Sergio Conde Gómez in bug #15624.

Discussion: https://postgr.es/m/15624-4dea54091a2864e6@postgresql.org
parent ccae096b
No related branches found
No related tags found
No related merge requests found
......@@ -1636,7 +1636,10 @@ xml_errorHandler(void *data, xmlErrorPtr error)
appendStringInfo(errorBuf, "line %d: ", error->line);
if (name != NULL)
appendStringInfo(errorBuf, "element %s: ", name);
if (error->message != NULL)
appendStringInfoString(errorBuf, error->message);
else
appendStringInfoString(errorBuf, "(no message provided)");
/*
* Append context information to errorBuf.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment