aboutsummaryrefslogtreecommitdiff
path: root/contrib/xml2/xslt_proc.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-01-17 14:03:55 +0900
committerMichael Paquier <michael@paquier.xyz>2024-01-17 14:03:55 +0900
commit2197d06224a14dba544e05e3df1efcca83bdd9ef (patch)
tree90ec4d973f0f11d068ce824efddcb054e343ec11 /contrib/xml2/xslt_proc.c
parent65c5864d7fac46516f17ee89085e349a87ee5bd7 (diff)
downloadpostgresql-2197d06224a14dba544e05e3df1efcca83bdd9ef.tar.gz
postgresql-2197d06224a14dba544e05e3df1efcca83bdd9ef.zip
Add support for parsing of large XML data (>= 10MB)
This commit adds XML_PARSE_HUGE to the libxml2 functions used in core for the parsing of XML objects, raising up the original limit of 10MB supported by libxml2. In most code paths of upstream, XML_MAX_TEXT_LENGTH (10^7) is the historical limit that gets upgraded to XML_MAX_HUGE_LENGTH (10^9) once XML_PARSE_HUGE is given to the parser calls. These are still limited by any palloc() calls for text, up to 1GB. This offers the possibility to handle within the backend XML objects larger than 10MB in general, with also a higher depth limit. This change affects the contrib module xml2, the xml data type and SQL/XML. Author: Dmitry Koval Reviewed-by: Tom Lane, Michael Paquier Discussion: https://postgr.es/m/18274-98d16bc03520665f@postgresql.org
Diffstat (limited to 'contrib/xml2/xslt_proc.c')
-rw-r--r--contrib/xml2/xslt_proc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/xml2/xslt_proc.c b/contrib/xml2/xslt_proc.c
index f30a3a42c03..9cbc05db1ab 100644
--- a/contrib/xml2/xslt_proc.c
+++ b/contrib/xml2/xslt_proc.c
@@ -87,7 +87,7 @@ xslt_process(PG_FUNCTION_ARGS)
/* Parse document */
doctree = xmlReadMemory((char *) VARDATA_ANY(doct),
VARSIZE_ANY_EXHDR(doct), NULL, NULL,
- XML_PARSE_NOENT);
+ XML_PARSE_HUGE | XML_PARSE_NOENT);
if (doctree == NULL)
xml_ereport(xmlerrcxt, ERROR, ERRCODE_EXTERNAL_ROUTINE_EXCEPTION,
@@ -96,7 +96,7 @@ xslt_process(PG_FUNCTION_ARGS)
/* Same for stylesheet */
ssdoc = xmlReadMemory((char *) VARDATA_ANY(ssheet),
VARSIZE_ANY_EXHDR(ssheet), NULL, NULL,
- XML_PARSE_NOENT);
+ XML_PARSE_HUGE | XML_PARSE_NOENT);
if (ssdoc == NULL)
xml_ereport(xmlerrcxt, ERROR, ERRCODE_EXTERNAL_ROUTINE_EXCEPTION,