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



commit 4b031aadfbab03e609c1e276080a8b385c3a4c6a
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 030293b5..2173265f 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -302,7 +302,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]