Commit b8e5df3f authored by Dom Lachowicz's avatar Dom Lachowicz

Bug 361267 - SVGs with duplicate IDs cause Nautilus/eog to crash.

	* rsvg-structure.c: Bug 361267 - SVGs with duplicate IDs cause Nautilus/eog to
	crash. Basically, a <use> used itself, causing infinite drawing recursion.
parent af839925
2006-11-02 Dom Lachowicz <domlachowicz@gmail.com>
* configure.in: 2.16.1
2006-11-02 Dom Lachowicz <domlachowicz@gmail.com>
* rsvg-structure.c: Bug 361267 - SVGs with duplicate IDs cause Nautilus/eog to
crash. Basically, a <use> used itself, causing infinite drawing recursion.
2006-11-02 Dom Lachowicz <domlachowicz@gmail.com>
......
......@@ -280,7 +280,7 @@ static const GTypeInfo rsvg_type_info = {
static GType rsvg_type = 0;
/* HACK to get around bugs 357406 and 362217 */
/* HACK to get around bugs 357406 and 362217. private API for now. */
GType
_rsvg_register_types(GTypeModule *module)
{
......
......@@ -168,6 +168,33 @@ rsvg_node_group_pack (RsvgNode *self, RsvgNode *child)
child->parent = self;
}
static gboolean
rsvg_node_is_ancestor (RsvgNode * potential_ancestor,
RsvgNode * potential_descendant)
{
if(!potential_ancestor)
return FALSE;
else if(potential_descendant == potential_ancestor)
return TRUE;
else if(potential_ancestor->children) {
GPtrArray *children;
guint i, len;
children = potential_ancestor->children;
len = children->len;
for(i = 0; i < len; i++) {
RsvgNode * child;
child = (RsvgNode *)g_ptr_array_index (children, i);
if(rsvg_node_is_ancestor (child, potential_descendant))
return TRUE;
}
}
return FALSE;
}
static void
rsvg_node_use_draw (RsvgNode * self, RsvgDrawingCtx *ctx,
int dominate)
......@@ -187,8 +214,11 @@ rsvg_node_use_draw (RsvgNode * self, RsvgDrawingCtx *ctx,
child = use->link;
/* If it can find nothing to draw... draw nothing */
if (!use->link)
if (!child)
return;
else if(rsvg_node_is_ancestor (child, self)) /* or, if we're <use>'ing ourself */
return;
state = rsvg_state_current(ctx);
if (strcmp(child->type->str, "symbol"))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment