[librsvg] Avoid crashing on an invalid atts field
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Avoid crashing on an invalid atts field
- Date: Tue, 6 Sep 2011 22:00:33 +0000 (UTC)
commit b54b065983e8fa7e2492fd0f741052c6f8441e4a
Author: Vincent Penquerc'h <vincent penquerch collabora co uk>
Date: Thu Aug 18 12:59:23 2011 +0100
Avoid crashing on an invalid atts field
Initialize it to NULL at construction, and test for it being NULL
before using it.
rsvg-structure.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/rsvg-structure.c b/rsvg-structure.c
index 33889be..572036c 100644
--- a/rsvg-structure.c
+++ b/rsvg-structure.c
@@ -369,7 +369,7 @@ void
_rsvg_node_svg_apply_atts (RsvgNodeSvg * self, RsvgHandle * ctx)
{
const char *id = NULL, *klazz = NULL, *value;
- if (rsvg_property_bag_size (self->atts)) {
+ if (self->atts && rsvg_property_bag_size (self->atts)) {
if ((value = rsvg_property_bag_lookup (self->atts, "class")))
klazz = value;
if ((value = rsvg_property_bag_lookup (self->atts, "id")))
@@ -406,6 +406,7 @@ rsvg_new_svg (void)
svg->super.draw = rsvg_node_svg_draw;
svg->super.free = _rsvg_svg_free;
svg->super.set_atts = rsvg_node_svg_set_atts;
+ svg->atts = NULL;
return &svg->super;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]