[librsvg/librsvg-2.44] (#342): Don't crash if a <use> node references one of its ancestors



commit 4c6810944fa8872f500371e78a123ba47977adbc
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Sep 20 14:01:02 2018 -0500

    (#342): Don't crash if a <use> node references one of its ancestors
    
    Sigh, the arguments to is_ancestor() were backwards.
    
    https://gitlab.gnome.org/GNOME/librsvg/issues/342

 rsvg_internals/src/structure.rs                             | 2 +-
 tests/fixtures/render-crash/342-use-references-ancestor.svg | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 0b20328a..64935e0a 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -295,7 +295,7 @@ impl NodeTrait for NodeUse {
             return Ok(());
         };
 
-        if Node::is_ancestor(node.clone(), child.clone()) {
+        if Node::is_ancestor(child.clone(), node.clone()) {
             // or, if we're <use>'ing ourselves
             return Err(RenderingError::CircularReference);
         }
diff --git a/tests/fixtures/render-crash/342-use-references-ancestor.svg 
b/tests/fixtures/render-crash/342-use-references-ancestor.svg
new file mode 100644
index 00000000..6d8c114e
--- /dev/null
+++ b/tests/fixtures/render-crash/342-use-references-ancestor.svg
@@ -0,0 +1,5 @@
+<svg>
+  <g id="g">
+    <use xlink:href="#g"/>
+  </g>
+</svg>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]