Skip to content

Instantly share code, notes, and snippets.

@cporter
Created November 27, 2013 21:32
Show Gist options
  • Save cporter/7683620 to your computer and use it in GitHub Desktop.
Save cporter/7683620 to your computer and use it in GitHub Desktop.
Make librsvg always allow possibly ill-formed documents.
diff --git a/rsvg-base.c b/rsvg-base.c
index 6210716..fe9a6cb 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -1111,6 +1111,7 @@ rsvg_handle_write_impl (RsvgHandle * handle, const guchar * buf, gsize count, GE
if (handle->priv->ctxt == NULL) {
handle->priv->ctxt = xmlCreatePushParserCtxt (&rsvgSAXHandlerStruct, handle, NULL, 0,
rsvg_handle_get_base_uri (handle));
+ handle->priv->ctxt->options |= XML_PARSE_HUGE;
/* if false, external entities work, but internal ones don't. if true, internal entities
work, but external ones don't. favor internal entities, in order to not cause a
@@ -1767,6 +1768,7 @@ rsvg_handle_read_stream_sync (RsvgHandle *handle,
if (priv->ctxt == NULL) {
priv->ctxt = xmlCreatePushParserCtxt (&rsvgSAXHandlerStruct, handle, NULL, 0,
rsvg_handle_get_base_uri (handle));
+ handle->priv->ctxt->options |= XML_PARSE_HUGE;
/* if false, external entities work, but internal ones don't. if true, internal entities
work, but external ones don't. favor internal entities, in order to not cause a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment