[librsvg: 1/5] Fix a feConvolveMatrix crash when kernel isn't set
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/5] Fix a feConvolveMatrix crash when kernel isn't set
- Date: Tue, 18 Sep 2018 20:09:23 +0000 (UTC)
commit 97c6998b4507067595a938038d7ae58cfa71bc66
Author: Ivan Molodetskikh <yalterz gmail com>
Date: Thu Sep 13 20:52:31 2018 +0300
Fix a feConvolveMatrix crash when kernel isn't set
rsvg_internals/src/filters/convolve_matrix.rs | 8 ++++++++
tests/fixtures/crash/feConvolveMatrix-empty-kernel.svg | 7 +++++++
2 files changed, 15 insertions(+)
---
diff --git a/rsvg_internals/src/filters/convolve_matrix.rs b/rsvg_internals/src/filters/convolve_matrix.rs
index 5b5cc66c..186fa397 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -196,6 +196,14 @@ impl NodeTrait for ConvolveMatrix {
}));
}
+ // kernel_matrix must have been specified.
+ if self.kernel_matrix.borrow().is_none() {
+ return Err(NodeError::value_error(
+ Attribute::KernelMatrix,
+ "the value must be set",
+ ));
+ }
+
// Default value for the divisor.
if self.divisor.get().is_none() {
self.divisor.set(Some(
diff --git a/tests/fixtures/crash/feConvolveMatrix-empty-kernel.svg
b/tests/fixtures/crash/feConvolveMatrix-empty-kernel.svg
new file mode 100644
index 00000000..d79ff7ee
--- /dev/null
+++ b/tests/fixtures/crash/feConvolveMatrix-empty-kernel.svg
@@ -0,0 +1,7 @@
+<svg version="1.1" baseProfile="full" id="svg-root"
+ width="100%" height="100%" viewBox="0 0 480 360"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <filter id="convolve1" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+ <feConvolveMatrix />
+ </filter>
+</svg>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]