Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8e29567

Browse files
committed
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
1 parent 8cf3fad commit 8e29567

File tree

1 file changed

+4
-1
lines changed
  • src/backend/utils/adt

1 file changed

+4
-1
lines changed

src/backend/utils/adt/xml.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,10 @@ xml_errorHandler(void *data, xmlErrorPtr error)
16961696
appendStringInfo(errorBuf, "line %d: ", error->line);
16971697
if (name != NULL)
16981698
appendStringInfo(errorBuf, "element %s: ", name);
1699-
appendStringInfoString(errorBuf, error->message);
1699+
if (error->message != NULL)
1700+
appendStringInfoString(errorBuf, error->message);
1701+
else
1702+
appendStringInfoString(errorBuf, "(no message provided)");
17001703

17011704
/*
17021705
* Append context information to errorBuf.

0 commit comments

Comments
 (0)