[librsvg] Check the result on all uses of rsvg_parse_transform() and propagate errors
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Check the result on all uses of rsvg_parse_transform() and propagate errors
- Date: Tue, 21 Mar 2017 22:57:38 +0000 (UTC)
commit 1165cc80a0712c41904b3e6b3f09755736c67392
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Mar 21 13:43:29 2017 -0600
Check the result on all uses of rsvg_parse_transform() and propagate errors
rsvg-paint-server.c | 27 +++++++++++++++++++++------
rsvg-styles.h | 2 +-
2 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/rsvg-paint-server.c b/rsvg-paint-server.c
index 807373f..3caccbd 100644
--- a/rsvg-paint-server.c
+++ b/rsvg-paint-server.c
@@ -326,8 +326,13 @@ rsvg_linear_gradient_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle
g_free (grad->fallback);
grad->fallback = g_strdup (rsvg_property_bag_lookup (atts, "xlink:href"));
if ((value = rsvg_property_bag_lookup (atts, "gradientTransform"))) {
- rsvg_parse_transform (&grad->affine, value);
- grad->hastransform = TRUE;
+ if (rsvg_parse_transform (&grad->affine, value)) {
+ grad->hastransform = TRUE;
+ } else {
+ rsvg_node_set_attribute_parse_error (node,
+ "gradientTransform",
+ "Invalid transformation");
+ }
}
if ((value = rsvg_property_bag_lookup (atts, "gradientUnits"))) {
if (!strcmp (value, "userSpaceOnUse"))
@@ -405,8 +410,13 @@ rsvg_radial_gradient_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle
g_free (grad->fallback);
grad->fallback = g_strdup (rsvg_property_bag_lookup (atts, "xlink:href"));
if ((value = rsvg_property_bag_lookup (atts, "gradientTransform"))) {
- rsvg_parse_transform (&grad->affine, value);
- grad->hastransform = TRUE;
+ if (rsvg_parse_transform (&grad->affine, value)) {
+ grad->hastransform = TRUE;
+ } else {
+ rsvg_node_set_attribute_parse_error (node,
+ "gradientTransform",
+ "Invalid transformation");
+ }
}
if ((value = rsvg_property_bag_lookup (atts, "spreadMethod"))) {
if (!strcmp (value, "pad"))
@@ -485,8 +495,13 @@ rsvg_pattern_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPr
g_free (pattern->fallback);
pattern->fallback = g_strdup (rsvg_property_bag_lookup (atts, "xlink:href"));
if ((value = rsvg_property_bag_lookup (atts, "patternTransform"))) {
- rsvg_parse_transform (&pattern->affine, value);
- pattern->hastransform = TRUE;
+ if (rsvg_parse_transform (&pattern->affine, value)) {
+ pattern->hastransform = TRUE;
+ } else {
+ rsvg_node_set_attribute_parse_error (node,
+ "patternTransform",
+ "Invalid transformation");
+ }
}
if ((value = rsvg_property_bag_lookup (atts, "patternUnits"))) {
if (!strcmp (value, "userSpaceOnUse"))
diff --git a/rsvg-styles.h b/rsvg-styles.h
index e37f0e9..8d61dde 100644
--- a/rsvg-styles.h
+++ b/rsvg-styles.h
@@ -231,7 +231,7 @@ void rsvg_parse_style_attrs (RsvgHandle *ctx, RsvgNode *node, const char *tag,
const char *klazz, const char *id, RsvgPropertyBag * atts);
G_GNUC_INTERNAL
-gboolean rsvg_parse_transform (cairo_matrix_t *matrix, const char *src);
+gboolean rsvg_parse_transform (cairo_matrix_t *matrix, const char *src) G_GNUC_WARN_UNUSED_RESULT;
G_GNUC_INTERNAL
RsvgState *rsvg_state_parent (RsvgState * state);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]