diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-07-06 12:13:49 +0900 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2021-02-03 22:28:08 +0100 |
commit | 02424237c8c8f43b5b578d0d5ad0b50c332be002 (patch) | |
tree | 38d8111bcd43d4f59883dfc8dc68bd88ba0f7911 /kdecore/svgicons | |
parent | 71c0596f009783be42494775c6829cf28b8160c7 (diff) | |
download | tdelibs-02424237c8c8f43b5b578d0d5ad0b50c332be002.tar.gz tdelibs-02424237c8c8f43b5b578d0d5ad0b50c332be002.zip |
Fixed handling of svg images that caused an infinite loop (most notably
Kicker was hanging with 100% CPU usage).
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit ffe8e495d7e99cc2e235a5f5ac776b72a31627ff)
Diffstat (limited to 'kdecore/svgicons')
-rw-r--r-- | kdecore/svgicons/ksvgiconpainter.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kdecore/svgicons/ksvgiconpainter.cpp b/kdecore/svgicons/ksvgiconpainter.cpp index 1e83509db..0a2e2e2eb 100644 --- a/kdecore/svgicons/ksvgiconpainter.cpp +++ b/kdecore/svgicons/ksvgiconpainter.cpp @@ -747,7 +747,14 @@ public: d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - sfactor_sq = 1.0 / d - 0.25; + if (d) + { + sfactor_sq = 1.0 / d - 0.25; + } + else + { + sfactor_sq = 0; + } if(sfactor_sq < 0) sfactor_sq = 0; @@ -770,7 +777,7 @@ public: else if(th_arc > 0 && !sweepFlag) th_arc -= 2 * M_PI; - n_segs = (int) (int) ceil(fabs(th_arc / (M_PI * 0.5 + 0.001))); + n_segs = (int) ceil(fabs(th_arc / (M_PI * 0.5 + 0.001))); for(i = 0; i < n_segs; i++) { |