[librsvg] (#266) - Don't ignore the results of filters with errors in attributes



commit 5050dcf06dc6a0dd7948baddf104e236b49909a1
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Jun 1 13:36:22 2018 -0500

    (#266) - Don't ignore the results of filters with errors in attributes
    
    The only remaining C nodes are filters.  The NodeTrait implementation
    of CNode::set_atts() was returning Ok(()) always, even if the C code
    had called rsvg_node_set_attribute_parse_error().  Instead, actually
    return that error result so the rest of the code will know about it.
    
    Additionally, don't render filter primitives that are in error.
    
    https://gitlab.gnome.org/GNOME/librsvg/issues/266

 rsvg_internals/src/cnode.rs                        |   2 +-
 .../266-filters-with-error-attributes.svg          | 187 +++++++++++++++++++++
 2 files changed, 188 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/cnode.rs b/rsvg_internals/src/cnode.rs
index f39a988c..31465247 100644
--- a/rsvg_internals/src/cnode.rs
+++ b/rsvg_internals/src/cnode.rs
@@ -36,7 +36,7 @@ impl NodeTrait for CNode {
             );
         }
 
-        Ok(())
+        node.get_result()
     }
 
     fn get_c_impl(&self) -> *const RsvgCNodeImpl {
diff --git a/tests/fixtures/render-crash/266-filters-with-error-attributes.svg 
b/tests/fixtures/render-crash/266-filters-with-error-attributes.svg
new file mode 100644
index 00000000..34654903
--- /dev/null
+++ b/tests/fixtures/render-crash/266-filters-with-error-attributes.svg
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="64"
+   height="64"
+   id="svg2463"
+   sodipodi:version="0.32"
+   inkscape:version="0.47 r22583"
+   version="1.0"
+   sodipodi:docname="star.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape">
+  <defs
+     id="defs2465">
+    <linearGradient
+       id="linearGradient3596">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop3598" />
+      <stop
+         id="stop3604"
+         offset="0.35157821"
+         style="stop-color:#ffffff;stop-opacity:0.82681566;" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="1"
+         id="stop3600" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3262">
+      <stop
+         style="stop-color:#f5f5f5;stop-opacity:0.22680412;"
+         offset="0"
+         id="stop3264" />
+      <stop
+         style="stop-color:#f5f5f5;stop-opacity:0.96078432;"
+         offset="1"
+         id="stop3266" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3751"
+       inkscape:collect="always">
+      <stop
+         id="stop3753"
+         offset="0"
+         style="stop-color:black;stop-opacity:1;" />
+      <stop
+         id="stop3755"
+         offset="1"
+         style="stop-color:black;stop-opacity:0;" />
+    </linearGradient>
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 526.18109 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+       id="perspective2471" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3751"
+       id="linearGradient3272"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.3868046,0,0,0.3868046,40.335717,481.59837)"
+       x1="665.12128"
+       y1="684.16162"
+       x2="381.28015"
+       y2="449.80624" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3751"
+       id="linearGradient2406"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.3868046,0,0,0.3868046,43.114888,485.8841)"
+       x1="665.12128"
+       y1="684.16162"
+       x2="381.28015"
+       y2="449.80624" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="radialGradient3602"
+       cx="31.851444"
+       cy="31.795218"
+       fx="31.851444"
+       fy="31.795218"
+       r="30.551558"
+       gradientTransform="matrix(1,0,0,0.95456924,0,1.3128087)"
+       gradientUnits="userSpaceOnUse" />
+    <filter
+       id="filter3086"
+       inkscape:label="Drop shadow"
+       width="1.5"
+       height="1.5"
+       x="-.25"
+       y="-.25">
+      <feGaussianBlur
+         id="feGaussianBlur3088"
+         in="SourceAlpha"
+         stdDeviation="4,000000"
+         result="blur" />
+      <feColorMatrix
+         id="feColorMatrix3090"
+         result="bluralpha"
+         type="matrix"
+         values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 0,500000 0 " />
+      <feOffset
+         id="feOffset3092"
+         in="bluralpha"
+         dx="0,000000"
+         dy="0,000000"
+         result="offsetBlur" />
+      <feMerge
+         id="feMerge3094">
+        <feMergeNode
+           id="feMergeNode3096"
+           in="offsetBlur" />
+        <feMergeNode
+           id="feMergeNode3098"
+           in="SourceGraphic" />
+      </feMerge>
+    </filter>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#f5f5f5"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="5.6"
+     inkscape:cx="26.939127"
+     inkscape:cy="39.646263"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1440"
+     inkscape:window-height="854"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata2468">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-110.35967,-771.51188)">
+    <path
+       sodipodi:type="star"
+       
style="fill:url(#radialGradient3602);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter3086)"
+       id="path2822"
+       sodipodi:sides="5"
+       sodipodi:cx="31.964287"
+       sodipodi:cy="31.857143"
+       sodipodi:r1="32.125885"
+       sodipodi:r2="4.8188829"
+       sodipodi:arg1="0.93111088"
+       sodipodi:arg2="1.5577518"
+       inkscape:flatsided="false"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="M 51.141613,57.631213 32.027145,36.675616 13.377809,58.06049 27.401071,33.405915 
1.2998864,22.277632 29.081206,27.995864 31.599122,-0.26666619 34.745661,27.92197 62.403003,21.583048 
36.566351,33.286352 51.141613,57.631213 z"
+       transform="matrix(1.0474097,0,0,1.0972591,108.99816,771.80448)" />
+  </g>
+</svg>


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