[librsvg] Fix for NULL strings
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Fix for NULL strings
- Date: Wed, 9 Nov 2011 17:24:01 +0000 (UTC)
commit f983fc12f82fcecca7d02876637584b7b4d0d523
Author: Kurosawa Takeshi <taken spc gmail com>
Date: Wed Nov 9 18:23:30 2011 +0100
Fix for NULL strings
https://bugzilla.gnome.org/show_bug.cgi?id=624820
rsvg-styles.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/rsvg-styles.c b/rsvg-styles.c
index 41a1b78..bbb9629 100644
--- a/rsvg-styles.c
+++ b/rsvg-styles.c
@@ -468,6 +468,9 @@ rsvg_parse_style_pair (RsvgHandle * ctx,
if (data && data->important && !important)
return;
+ if (name == NULL || value == NULL)
+ return;
+
g_hash_table_insert (state->styles,
(gpointer) g_strdup (name),
(gpointer) style_value_data_new (value, important));
@@ -914,6 +917,10 @@ parse_style_value (const gchar *string, gchar **value, gboolean *important)
gchar **strings;
strings = g_strsplit (string, "!", 2);
+
+ if (strings[0] == NULL)
+ return FALSE;
+
if (g_strv_length (strings) == 2 &&
g_str_equal (g_strstrip (strings[1]), "important")) {
*important = TRUE;
@@ -949,14 +956,14 @@ rsvg_parse_style (RsvgHandle * ctx, RsvgState * state, const char *str)
if (!values)
continue;
- if (g_strv_length (values) == 2) {
+ if (g_strv_length (values) == 2) {
gboolean important;
gchar *style_value = NULL;
- parse_style_value (values[1], &style_value, &important);
- rsvg_parse_style_pair (ctx, state,
- g_strstrip (values[0]),
- style_value,
- important);
+ if (parse_style_value (values[1], &style_value, &important))
+ rsvg_parse_style_pair (ctx, state,
+ g_strstrip (values[0]),
+ style_value,
+ important);
g_free (style_value);
}
g_strfreev (values);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]