librsvg r1208 - trunk



Author: doml
Date: Thu Feb 19 23:39:40 2009
New Revision: 1208
URL: http://svn.gnome.org/viewvc/librsvg?rev=1208&view=rev

Log:
2009-02-19  Christian Persch  <chpe gnome org>

        * rsvg-base.c: fails to parse SVG with parameter entities. Bug #567311



Modified:
   trunk/ChangeLog
   trunk/rsvg-base.c

Modified: trunk/rsvg-base.c
==============================================================================
--- trunk/rsvg-base.c	(original)
+++ trunk/rsvg-base.c	Thu Feb 19 23:39:40 2009
@@ -807,6 +807,21 @@
     else if (publicId)
         resolvedPublicId = xmlBuildRelativeURI (publicId, (xmlChar*) rsvg_handle_get_base_uri (ctx));
 
+    if (type == XML_EXTERNAL_PARAMETER_ENTITY && !content) {
+      GByteArray *arr;
+
+      if (systemId)
+        arr = _rsvg_acquire_xlink_href_resource ((const char *) systemId,
+                                                 rsvg_handle_get_base_uri (ctx), NULL);
+      else if (publicId)
+        arr = _rsvg_acquire_xlink_href_resource ((const char *) publicId,
+                                                 rsvg_handle_get_base_uri (ctx), NULL);
+      if (arr) {
+        content = xmlCharStrndup ((const char*)arr->data, arr->len);
+        g_byte_array_free(arr, TRUE);
+      }
+    }
+      
     entity = xmlNewEntity(NULL, name, type, resolvedPublicId, resolvedSystemId, content);
 
     free(resolvedPublicId);
@@ -864,6 +879,17 @@
     rsvg_entity_decl (ctx, name, XML_INTERNAL_GENERAL_ENTITY, publicId, systemId, NULL);
 }
 
+static xmlEntityPtr
+rsvg_get_parameter_entity (void *data, const xmlChar * name)
+{
+    RsvgHandle *ctx = (RsvgHandle *) data;
+    xmlEntityPtr entity;
+
+    entity = g_hash_table_lookup (ctx->priv->entities, name);
+
+    return entity;
+}
+
 #endif
 
 static void
@@ -932,6 +958,7 @@
         rsvgSAXHandlerStruct.getEntity = rsvg_get_entity;
         rsvgSAXHandlerStruct.entityDecl = rsvg_entity_decl;
         rsvgSAXHandlerStruct.unparsedEntityDecl = rsvg_unparsed_entity_decl;
+        rsvgSAXHandlerStruct.getParameterEntity = rsvg_get_parameter_entity;
 #endif
         rsvgSAXHandlerStruct.characters = rsvg_characters;
         rsvgSAXHandlerStruct.error = rsvg_error_cb;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]