summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2020-07-06 12:13:49 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-07-06 22:26:21 +0900
commit050589bc4f1d7d70a59d1dd755b6ca7a8cc0e1b2 (patch)
tree73e9f7b6648670e6b69b8414f37f16352f00b504
parent1f77e1ff6e42bfbc9147ded915bbb72b1c0a8a86 (diff)
downloadtdelibs-050589bc4f1d7d70a59d1dd755b6ca7a8cc0e1b2.tar.gz
tdelibs-050589bc4f1d7d70a59d1dd755b6ca7a8cc0e1b2.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)
-rw-r--r--tdecore/svgicons/ksvgiconpainter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/tdecore/svgicons/ksvgiconpainter.cpp b/tdecore/svgicons/ksvgiconpainter.cpp
index ca781db15..122c8432d 100644
--- a/tdecore/svgicons/ksvgiconpainter.cpp
+++ b/tdecore/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++)
{