[librsvg: 1/2] (#698): Put limit on feMorphology radii to prevent thread hang
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/2] (#698): Put limit on feMorphology radii to prevent thread hang
- Date: Mon, 12 Apr 2021 16:50:23 +0000 (UTC)
commit 432915744376d83f212212254c63b68e57c2092a
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
src/filters/morphology.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/filters/morphology.rs b/src/filters/morphology.rs
index 073fdcf8..ec6e753f 100644
--- a/src/filters/morphology.rs
+++ b/src/filters/morphology.rs
@@ -97,7 +97,8 @@ impl Morphology {
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]