Bug 219293 - kstars crash due to stack smashing "attack" when compiled with -fstack-protector-all
Summary: kstars crash due to stack smashing "attack" when compiled with -fstack-protec...
Status: RESOLVED NOT A BUG
Alias: None
Product: kstars
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Akarsh Simha
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-19 12:41 UTC by Hugo Mildenberger
Modified: 2010-04-24 17:40 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch against kstars/kstars/skyobjects/saturnmoons.cpp (7.47 KB, patch)
2009-12-20 18:13 UTC, Hugo Mildenberger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Mildenberger 2009-12-19 12:41:33 UTC
Version:           KStars: 1.5.3 (using KDE 4.3.4)
Compiler:          gcc-4.3.4 with Gentoo hardened patches 4.3.4 p1.0, pie-10.1.5
OS:                Linux
Installed from:    Gentoo Packages

#0  0x4f935422 in __kernel_vsyscall ()
#1  0x4da8909b in __stack_chk_fail () 
    at stack_chk_fail.c:296
#2  0x119ea860 in __stack_chk_fail_local () 
     from /usr/bin/kstars
#3  0x1196a40e in SaturnMoons::findPosition
    (this=0x134dc088, num=0x5a98a2a0, 
    Saturn=0x11b80fb0, Sun=0x11b782d8)
    at /usr/src/debug/kde-base/kstars-4.3.4/
       kstars-4.3.4/
       kstars/kstars/skyobjects/saturnmoons.cpp:476
#4  0x117fc86b in SaturnMoonsComponent::updateMoons
                 (this=0x11b81dc0,num=0x5a98a2a0)
    at /usr/src/debug/kde-base/kstars-4.3.4/
        kstars-4.3.4/kstars/
        kstars/skycomponents/saturnmoonscomponent.cpp:65


The reason for this are numerous off-by-one indexing errors in SaturnMoons::findPosition from kstars/kstars/skyobjects/saturnmoons.cpp. KDE Bugs #150899 and #154650 are perhaps related.

See also http://bugs.gentoo.org/show_bug.cgi?id=297467
Comment 1 Hugo Mildenberger 2009-12-20 18:13:40 UTC
Created attachment 39192 [details]
patch against kstars/kstars/skyobjects/saturnmoons.cpp



This patch fixes four issues:
 1.) The author assumed C arrays would start with element 1. The
     consequence was a stack smashing "attack" detected when
     compiled with -fstack-protector-all
 2.) summing up angles given in degrees with angles given in radians:
     see double u = 2*W5 - 2*theta + psi;
 3.) remove unnecessary calls to MapTo0To360Range
 4.) remove unused, superflous arrays declarations

HOWEVER: Saturn's moons positions still appear to be wrong when
         compared to the output of JPL's solar system simulator 
         for any given date (here: http://space.jpl.nasa.gov/)
Comment 2 Alexey Khudiakov 2010-04-24 17:40:44 UTC
Thank you for bug report and patch but code for Saturn moons was removed due to copyright violation. 

I'm therefore closing the bug.