[librsvg/librsvg-2.50] (#698): Put limit on feMorphology radii to prevent thread hang



commit 7cae21515dbcf552d63bf7925255c827b0bceb61
Author: Madds <madds hollandart io>
Date:   Sat Apr 10 22:55:36 2021 -0500

    (#698): Put limit on feMorphology radii to prevent thread hang
    
    Limits feMorphology radii to 10.0, a somewhat arbitrary number that I attempted to balance quickly (on a 
Ryzen system) opening eog and having a wide range for the effect.
    The examples for radius size I could find only had it go as high as 3, so I figured 10 would be safe.
    If there's something I've done wrong, or how I implemented it is odd for rust's conventions please let me 
know!
    
    https://gitlab.gnome.org/GNOME/librsvg/-/issues/698

 rsvg_internals/src/filters/morphology.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/filters/morphology.rs b/rsvg_internals/src/filters/morphology.rs
index a51271a5..08c9982d 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -91,7 +91,8 @@ impl FilterEffect for FeMorphology {
         let (rx, ry) = ctx.paffine().transform_distance(rx, ry);
 
         // The radii can become negative here due to the transform.
-        let (rx, ry) = (rx.abs(), ry.abs());
+        // Additionally The radii being excessively large causes cpu hangups
+        let (rx, ry) = (rx.abs().min(10.0), ry.abs().min(10.0));
 
         let mut surface = ExclusiveImageSurface::new(
             ctx.source_graphic().width(),


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