aboutsummaryrefslogtreecommitdiffstats
path: root/core/save-xml.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2021-04-20 14:09:29 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-21 08:39:29 -0700
commita0a631122ab345306fe106288a0bd1d3f2b8f3da (patch)
tree72fc55b94a30f2c62d1a21bc19a616ca1e7e80a9 /core/save-xml.c
parent194fe28d5053027cb6f3818f836ffb0f57667ef7 (diff)
downloadsubsurface-a0a631122ab345306fe106288a0bd1d3f2b8f3da.tar.gz
xml parsing: add XML_PARSE_HUGE flag to xmlReadMemory()
It looks like libxml2 has some internal limitations by default that causes parse failures in some situations. Avoid them with XML_PARSE_HUGE. Without this, you get errors like test.xml:349250: parser error : internal error: Huge input lookup όμουν τουλάχιστον αλλά +2kg και ενδεχομένως +4 ^ when something in the xml file grows too large. I don't know libxml2 internals, so I have no idea what exactly goes wrong, but the docs say: XML_PARSE_HUGE = 524288 : relax any hardcoded limit from the parser and that makes us successfully parse the Greek file from Kostas. Reported-by: Kostas Katsioulis <kostaskatsioulis@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/save-xml.c')
-rw-r--r--core/save-xml.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/save-xml.c b/core/save-xml.c
index 9d5b8f6f8..4c7c2ee04 100644
--- a/core/save-xml.c
+++ b/core/save-xml.c
@@ -871,7 +871,7 @@ static int export_dives_xslt_doit(const char *filename, struct xml_params *param
* transform it to selected export format, finally dumping
* the XML into a character buffer.
*/
- doc = xmlReadMemory(buf.buffer, buf.len, "divelog", NULL, 0);
+ doc = xmlReadMemory(buf.buffer, buf.len, "divelog", NULL, XML_PARSE_HUGE);
free_buffer(&buf);
if (!doc)
return report_error("Failed to read XML memory");