mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
194fe28d50
commit
a0a631122a
2 changed files with 3 additions and 3 deletions
|
@ -1748,9 +1748,9 @@ int parse_xml_buffer(const char *url, const char *buffer, int size,
|
|||
state.sites = sites;
|
||||
state.devices = devices;
|
||||
state.filter_presets = filter_presets;
|
||||
doc = xmlReadMemory(res, strlen(res), url, NULL, 0);
|
||||
doc = xmlReadMemory(res, strlen(res), url, NULL, XML_PARSE_HUGE);
|
||||
if (!doc)
|
||||
doc = xmlReadMemory(res, strlen(res), url, "latin1", 0);
|
||||
doc = xmlReadMemory(res, strlen(res), url, "latin1", XML_PARSE_HUGE);
|
||||
|
||||
if (res != buffer)
|
||||
free((char *)res);
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue