Commit b02b2660 authored by Kurosawa Takeshi's avatar Kurosawa Takeshi Committed by Christian Persch

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
parent 10918c76
......@@ -1206,6 +1206,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++)
......@@ -1215,9 +1218,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);
}
......@@ -1236,6 +1236,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;
......
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