summaryrefslogtreecommitdiffstats
path: root/src/xml/repr-io.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-04-30 17:06:29 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-04-30 17:06:29 +0000
commit112f963fb12a941762c828dfd1690a61771516af (patch)
tree581dba7c9349f1c4d33221220c24798a7f9cf4e1 /src/xml/repr-io.cpp
parentCDR/VSD input: Avoid crash when preview image can not be rendered and show a ... (diff)
downloadinkscape-112f963fb12a941762c828dfd1690a61771516af.tar.gz
inkscape-112f963fb12a941762c828dfd1690a61771516af.zip
Relax any hardcoded limit from the libxml2 parser when creating documents from memory
This fixes many bugs (mostly caused by very long image data URIs) Fixed bugs: - https://launchpad.net/bugs/1572280 - https://launchpad.net/bugs/1412912 - https://launchpad.net/bugs/1373322 - https://launchpad.net/bugs/1243011 - https://launchpad.net/bugs/1627004 - https://launchpad.net/bugs/1627004 (bzr r15654)
Diffstat (limited to 'src/xml/repr-io.cpp')
-rw-r--r--src/xml/repr-io.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index ae6f238d4..d8e0f5418 100644
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
@@ -404,7 +404,12 @@ Document *sp_repr_read_mem (const gchar * buffer, gint length, const gchar *defa
g_return_val_if_fail (buffer != NULL, NULL);
- doc = xmlParseMemory (const_cast<gchar *>(buffer), length);
+ int parser_options = XML_PARSE_HUGE | XML_PARSE_RECOVER;
+ parser_options |= XML_PARSE_NONET; // TODO: should we allow network access?
+ // proper solution would be to check the preference "/options/externalresources/xml/allow_net_access"
+ // as done in XmlSource::readXml which gets called by the analogous sp_repr_read_file()
+ // but sp_repr_read_mem() seems to be called in locations where Inkscape::Preferences::get() fails badly
+ doc = xmlReadMemory (const_cast<gchar *>(buffer), length, NULL, NULL, parser_options);
rdoc = sp_repr_do_read (doc, default_ns);
if (doc) {