Bug#986692: crash at startup
Just for reference, why g++ does not error here, this gcc bug might be interesting: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43943 Kind regards, Bernhard
Bug#986692: crash at startup
Dear Maintainer, I tried to have a look, but got no clue why a Unwind should take place until I saw the old build log [1]. There I found this warning: Levels.cpp: In member function ‘bool Levels::addLevel(const string&, int, int)’: Levels.cpp:118:1: warning: no return statement in function returning non-void [-Wreturn-type] 118 | } | ^ So I assume g++ puts no ret instruction to this method and therefore the Unwind gets executed because of this. I wonder why this is just a warning ... Attached patch contains a few changes for these warnings: warning: no return statement in function returning non-void [-Wreturn-type] warning: control reaches end of non-void function [-Wreturn-type] warning: attempt to free a non-heap object ‘host’ [-Wfree-nonheap-object] A build with this patch applied does not crash at startup. (Testing if it really starts up took longer than the actual error ;-) ) Kind regards, Bernhard [1] https://buildd.debian.org/status/fetch.php?pkg=numptyphysics&arch=amd64&ver=0.2%2Bsvn157-0.4&stamp=1573519484&raw=0 Bug-Debian: https://bugs.debian.org/986692 Forwarded: no Last-Update: 2021-04-22 --- numptyphysics-0.2+svn157.orig/Game.h +++ numptyphysics-0.2+svn157/Game.h @@ -58,7 +58,7 @@ struct GameControl virtual ~GameControl() {} virtual bool save( const char *file=NULL ) =0; virtual bool send() =0; - virtual bool load( const char* file ) {}; + virtual bool load( const char* file ) { return false; }; virtual void gotoLevel( int l, bool replay=false ) =0; virtual void clickMode(int cm) =0; Levels& levels() { return *m_levels; } --- numptyphysics-0.2+svn157.orig/Http.cpp +++ numptyphysics-0.2+svn157/Http.cpp @@ -114,7 +114,6 @@ bool Http::get( const char* uri, } fclose ( m_file ); - free( host ); return m_size > 0; } @@ -175,6 +174,7 @@ bool Http::post( const char* uri, const fprintf(stderr,"http_get wobbly: %s\n",w.what()); } } + return true; } --- numptyphysics-0.2+svn157.orig/Levels.cpp +++ numptyphysics-0.2+svn157/Levels.cpp @@ -114,7 +114,7 @@ bool Levels::addPath( const char* path ) bool Levels::addLevel( const string& file, int rank, int index ) { - addLevel( getCollection(MISC_COLLECTION), file, rank, index ); + return addLevel( getCollection(MISC_COLLECTION), file, rank, index ); } bool Levels::addLevel( Collection* collection, @@ -248,6 +248,7 @@ int Levels::collectionFromLevel( int i, } } } + return -1; } std::string Levels::collectionName( int i, bool pretty ) --- numptyphysics-0.2+svn157.orig/Scene.cpp +++ numptyphysics-0.2+svn157/Scene.cpp @@ -616,6 +616,7 @@ bool Scene::activateStroke( Stroke *s ) { activate(s); m_recorder.activateStroke( m_strokes.indexOf(s) ); + return true; } void Scene::getJointCandidates( Stroke* s, Path& pts ) --- numptyphysics-0.2+svn157.orig/Ui.cpp +++ numptyphysics-0.2+svn157/Ui.cpp @@ -1081,7 +1081,7 @@ bool Dialog::onEvent( Event& ev ) return Panel::onEvent(ev); } -bool Dialog::close() +void Dialog::close() { if (m_parent) { //fprintf(stderr,"close dialog\n"); --- numptyphysics-0.2+svn157.orig/Ui.h +++ numptyphysics-0.2+svn157/Ui.h @@ -321,7 +321,7 @@ class Dialog : public Panel void onTick( int tick ); bool processEvent( SDL_Event& ev ); bool onEvent( Event& ev ); - bool close(); + void close(); virtual Container* content() { return m_content; } Button* leftControl() { return m_left; } Button* rightControl() { return m_right; } --- numptyphysics-0.2+svn157.orig/Worker.cpp +++ numptyphysics-0.2+svn157/Worker.cpp @@ -64,4 +64,5 @@ int WorkerBase::startThread(void* wbase) event.user.data1 = wbase; event.user.data2 = 0; SDL_PushEvent(&event); + return 0; }
Bug#986692: crash at startup
I can confirm this, and the backtrace looks similar: #0 0x00080005 in ?? () #1 0x77a1d879 in _Unwind_ForcedUnwind_Phase2 (exc=0x55614e90, context=0x7fffdd70, frames_p=0x7fffdc78) at ../../../src/libgcc/unwind.inc:170 #2 0x77a1e14d in _Unwind_Resume (exc=exc@entry=0x55614e90) at ../../../src/libgcc/unwind.inc:243 #3 0x55560c65 in __gnu_cxx::new_allocator::~new_allocator (this=, __in_chrg=) at /usr/include/c++/9/ext/new_allocator.h:89 #4 std::allocator::~allocator (this=0x7fffdeb0, __in_chrg=) at /usr/include/c++/9/bits/allocator.h:153 #5 std::__cxx11::basic_string, std::allocator >::_Alloc_hider::~_Alloc_hider (this=, __in_chrg=) at /usr/include/c++/9/bits/basic_string.h:150 #6 std::__cxx11::basic_string, std::allocator >::~basic_string (this=, __in_chrg=) at /usr/include/c++/9/bits/basic_string.h:658 #7 Levels::addLevel (this=, file="/usr/share/numptyphysics/L99_Gravity_Test.nph", rank=99, index=-1) at Levels.cpp:117 valgrind says: Invalid read of size 8 at 0x4DFA810: ??? (in /usr/lib/x86_64-linux-gnu/libgcc_s.so.1) by 0x4DFB14C: _Unwind_Resume (in /usr/lib/x86_64-linux-gnu/libgcc_s.so.1) by 0x114C64: ~new_allocator (new_allocator.h:89) by 0x114C64: ~allocator (allocator.h:153) by 0x114C64: ~_Alloc_hider (basic_string.h:150) by 0x114C64: ~basic_string (basic_string.h:658) by 0x114C64: Levels::addLevel(std::__cxx11::basic_string, std::allocator > const&, int, int) [clone .cold] (Levels.cpp:117) by 0x11C9B3: Levels::addPath(char const*) (Levels.cpp:93) by 0x11C8CD: Levels::addPath(char const*) (Levels.cpp:104) by 0x12C7FE: runGame (App.cpp:184) by 0x12C7FE: run (App.cpp:110) by 0x12C7FE: npmain(int, char**) (App.cpp:372) by 0x1174FA: main (OsFreeDesktop.cpp:133) Address 0x68ec6b8 is 0 bytes after a block of size 24 alloc'd at 0x4838DEF: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x12BD89: runGame (App.cpp:173) by 0x12BD89: run (App.cpp:110) by 0x12BD89: npmain(int, char**) (App.cpp:372) by 0x1174FA: main (OsFreeDesktop.cpp:133) Some debugging suggests that the string being destroyed when it crashes is the "My Levels" std::string created from the static const char MISC_COLLECTION[] in Levels::addLevel() (no idea what is the problem with this code). -- WBR, wRAR signature.asc Description: PGP signature
Bug#986692: crash at startup
here the backtrace Type "apropos word" to search for commands related to "word"... Reading symbols from numptyphysics... Reading symbols from /usr/lib/debug/.build-id/1c/669beb5cdc6578b37b1e53e575baefe21524ff.debug... (gdb) r Starting program: /usr/games/numptyphysics [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x762e7700 (LWP 724966)] Thread 1 "numptyphysics" received signal SIGSEGV, Segmentation fault. 0x779f308f in _Unwind_Resume () from /lib/x86_64-linux-gnu/libgcc_s.so.1 (gdb) l 118 OsFreeDesktop.cpp: Aucun fichier ou dossier de ce type. (gdb) bt #0 0x779f308f in _Unwind_Resume () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #1 0x55560c58 in __gnu_cxx::new_allocator::~new_allocator (this=, __in_chrg=) at /usr/include/c++/10/ext/new_allocator.h:89 #2 std::allocator::~allocator (this=, __in_chrg=) at /usr/include/c++/10/bits/allocator.h:162 #3 std::__cxx11::basic_string, std::allocator >::_Alloc_hider::~_Alloc_hider (this=out>, __in_chrg=) at /usr/include/c++/10/bits/basic_string.h:150 #4 std::__cxx11::basic_string, std::allocator >::~basic_string (this=, __in_chrg=) at /usr/include/c++/10/bits/basic_string.h:658 #5 Levels::addLevel (this=, file="/usr/share/numptyphysics/L99_Gravity_Test.nph", rank=99, index=-1) at Levels.cpp:117 #6 0x555682f1 in Levels::addPath (this=0x5560cff0, path=0x555f3ef0 "/usr/share/numptyphysics/L99_Gravity_Test.nph") at Levels.cpp:93 #7 0x55568070 in Levels::addPath (this=this@entry=0x5560cff0, path=path@entry=0x5559ba6a "/usr/share/numptyphysics") at /usr/include/c++/10/bits/basic_string.h:186 #8 0x55575214 in App::runGame (height=480, width=800, files=..., this=0x7fffdfe0) at App.cpp:184 #9 App::run (this=0x7fffdfe0) at App.cpp:110 #10 0x55573726 in npmain (argc=argc@entry=1, argv=argv@entry=0x7fffe1b8) at App.cpp:372 #11 0x55562c0b in main (argc=1, argv=0x7fffe1b8) at OsFreeDesktop.cpp:133
Bug#986692: crash at startup
Package: numptyphysics Version: 0.2+svn157-0.4 Severity: grave X-Debbugs-Cc: pi...@debian.org the prgram do not start and crash at startup -- System Information: Debian Release: bullseye/sid APT prefers stable-debug APT policy: (500, 'stable-debug'), (500, 'proposed-updates-debug'), (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 5.10.0-4-amd64 (SMP w/4 CPU threads) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages numptyphysics depends on: ii fonts-femkeklaver1.0-3 ii libc62.31-11 ii libfontconfig1 2.13.1-4.2 ii libgcc-s1 [libgcc1] 10.2.1-6 ii libsdl-image1.2 1.2.12-12 ii libsdl-ttf2.0-0 2.0.11-6 ii libsdl1.2debian 1.2.15+dfsg2-6 ii libstdc++6 10.2.1-6 ii libx11-6 2:1.7.0-2 ii zlib1g 1:1.2.11.dfsg-2 numptyphysics recommends no packages. numptyphysics suggests no packages. -- no debconf information