| Summary: | kslideshow.kss crashes quietly when "Random Position" is selected | ||
|---|---|---|---|
| Product: | [Unmaintained] kscreensaver | Reporter: | Bryant Hansen <kde> |
| Component: | screensavers | Assignee: | kscreensaver bugs tracking <kscreensaver-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Gentoo Packages | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
SVN commit 666124 by ossi:
backport: fix div by 0
BUG: 138161
M +1 -1 slideshow.cpp
--- branches/KDE/3.5/kdeartwork/kscreensaver/kdesavers/slideshow.cpp #666123:666124
@@ -756,7 +756,7 @@
}
else
{
- if(iw > ww || ih > wh)
+ if(iw >= ww || ih >= wh)
{
fx = (double)ww / iw;
fy = (double)wh / ih;
|
Version: (using KDE KDE 3.5.5) Installed from: Gentoo Packages Compiler: gcc 4.1.1 OS: Linux The "Slide Show" screen saver in KDE Control Center only plays a handful of slides from a large collection and then dies. The problem only occurs when I have the "Random Position" setting checked. Today I determined the exact cause of the problem: it's in the calculation of the random position. When either the image width or the height matches the screen dimensions exactly, a divide-by-zero error results and the screen saver crashes. The offending lines of code are lines 778 and 779 in screensaver.cpp (KDE 3.5.5): x = rand() % (ww - iw); y = rand() % (wh - ih); One possible fix, which I've tested successfully, is to change the boundary-checking condition above. Line 759: if(iw > ww || ih > wh) Should be changed to: if(iw >= ww || ih >= wh)