index cb9f64a..57a5a87 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -573,7 +573,7 @@ rsvg_start_xinclude (RsvgHandle * ctx, RsvgPropertyBag * atts)
             goto fallback;
 
         xml_parser = xmlCreatePushParserCtxt (&rsvgSAXHandlerStruct, ctx, NULL, 0, NULL);
-        xml_parser->options |= XML_PARSE_NONET;
+        xml_parser->options |= XML_PARSE_NONET | XML_PARSE_HUGE;
 
         buffer = _rsvg_xml_input_buffer_new_from_stream (stream, NULL /* cancellable */, XML_CHAR_ENCODING_NONE, &err);
         g_object_unref (stream);
@@ -1113,7 +1113,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_NONET;
+        handle->priv->ctxt->options |= XML_PARSE_NONET | 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
@@ -1770,7 +1770,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));
-        priv->ctxt->options |= XML_PARSE_NONET;
+        priv->ctxt->options |= XML_PARSE_NONET | 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
diff --git a/rsvg-css.c b/rsvg-css.c
index d61cca2..fff0ae7 100644
--- a/rsvg-css.c
+++ b/rsvg-css.c
@@ -841,7 +841,7 @@ rsvg_css_parse_xml_attribute_string (const char *attribute_string)
     xmlSAX2InitDefaultSAXHandler (&handler, 0);
     handler.serror = rsvg_xml_noerror;
     parser = xmlCreatePushParserCtxt (&handler, NULL, tag, strlen (tag) + 1, NULL);
-    parser->options |= XML_PARSE_NONET;
+    parser->options |= XML_PARSE_NONET | XML_PARSE_HUGE;
 
     if (xmlParseDocument (parser) != 0)
         goto done;
