mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Revert "Add support for parsing of large XML data (>= 10MB)"
This reverts commit 2197d06224
, following a discussion over a Coverity
report where issues like the "Billion laugh attack" could cause the
backend to waste CPU and memory even if a client applied checks on the
size of the data given in input, and libxml2 does not offer guarantees
that input limits are respected under XML_PARSE_HUGE.
Discussion: https://postgr.es/m/ZbHlgrPLtBZyr_QW@paquier.xyz
This commit is contained in:
@ -381,7 +381,7 @@ pgxml_xpath(text *document, xmlChar *xpath, xpath_workspace *workspace)
|
||||
{
|
||||
workspace->doctree = xmlReadMemory((char *) VARDATA_ANY(document),
|
||||
docsize, NULL, NULL,
|
||||
XML_PARSE_HUGE | XML_PARSE_NOENT);
|
||||
XML_PARSE_NOENT);
|
||||
if (workspace->doctree != NULL)
|
||||
{
|
||||
workspace->ctxt = xmlXPathNewContext(workspace->doctree);
|
||||
@ -626,7 +626,7 @@ xpath_table(PG_FUNCTION_ARGS)
|
||||
if (xmldoc)
|
||||
doctree = xmlReadMemory(xmldoc, strlen(xmldoc),
|
||||
NULL, NULL,
|
||||
XML_PARSE_HUGE | XML_PARSE_NOENT);
|
||||
XML_PARSE_NOENT);
|
||||
else /* treat NULL as not well-formed */
|
||||
doctree = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user