[librsvg/gnome-3-2] Fix crash on invalid kernelMatrix attribute
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/gnome-3-2] Fix crash on invalid kernelMatrix attribute
- Date: Wed, 9 Nov 2011 17:24:45 +0000 (UTC)
commit 459ae104655873a5ab17f55e3e7c5109bb7a6c70
Author: Kurosawa Takeshi <taken spc gmail com>
Date: Wed Nov 9 18:18:21 2011 +0100
Fix crash on invalid kernelMatrix attribute
The image will now not crash librsvg, but doesn't render at all.
https://bugzilla.gnome.org/show_bug.cgi?id=624835
rsvg-filter.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/rsvg-filter.c b/rsvg-filter.c
index ce96c4f..d358de5 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -1205,6 +1205,9 @@ rsvg_filter_primitive_convolve_matrix_set_atts (RsvgNode * self,
rsvg_defs_register_name (ctx->priv->defs, value, &filter->super.super);
}
+ if ((gint) listlen != filter->orderx * filter->ordery)
+ filter->orderx = filter->ordery = 0;
+
if (filter->divisor == 0) {
for (j = 0; j < filter->orderx; j++)
for (i = 0; i < filter->ordery; i++)
@@ -1214,9 +1217,6 @@ rsvg_filter_primitive_convolve_matrix_set_atts (RsvgNode * self,
if (filter->divisor == 0)
filter->divisor = 1;
- if ((gint) listlen < filter->orderx * filter->ordery)
- filter->orderx = filter->ordery = 0;
-
if (!has_target_x) {
filter->targetx = floor (filter->orderx / 2);
}
@@ -1235,6 +1235,7 @@ rsvg_new_filter_primitive_convolve_matrix (void)
filter->super.result = g_string_new ("none");
filter->super.x.factor = filter->super.y.factor = filter->super.width.factor =
filter->super.height.factor = 'n';
+ filter->KernelMatrix = NULL;
filter->divisor = 0;
filter->bias = 0;
filter->dx = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]