Whales/Cataclysm — Issue #40: Segfault when falling from multiple ledges
Author: odd2k
Created: 2012-02-28 19:31:10+00:00
State: open

When falling over a ledge and going past several z-levels (like in missile silo), the game crashes with a segfault. For some reason, the last call to map::generate seems to end up with invalid stack values/pointers inside the function map::generate itself. Looks pretty complicated.

Segfault:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000695ec8 in map::generate (this=Cannot access memory at address 0x7fffff7b4168
) at mapgen.cpp:60

Backtrace:

#0 map::loadn (this=0x7fffff9a9070, g=0x7ffff7ed0010, worldx=294, worldy=349,
gridx=10, gridy=0) at map.cpp:1723
#1 0x000000000067b04d in map::load (this=0x7fffff9a9070, g=0x7ffff7ed0010,
wx=294, wy=349) at map.cpp:1454
#2 0x0000000000532988 in game::vertical_move (this=0x7ffff7ed0010, movez=-1,
force=true) at game.cpp:5384
#3 0x0000000000a090d8 in trapfunc::ledge (this=0x7fffffaef410,
g=0x7ffff7ed0010, x=62, y=67) at trapfunc.cpp:493
#4 0x0000000000533b07 in game::vertical_move (this=0x7ffff7ed0010, movez=-1,
force=true) at game.cpp:5526
#5 0x0000000000a090d8 in trapfunc::ledge (this=0x7fffffd0b9d0,
g=0x7ffff7ed0010, x=62, y=67) at trapfunc.cpp:493
#6 0x0000000000533b07 in game::vertical_move (this=0x7ffff7ed0010, movez=-1,
force=true) at game.cpp:5526
#7 0x0000000000a090d8 in trapfunc::ledge (this=0x7ffffff28120,
g=0x7ffff7ed0010, x=62, y=67) at trapfunc.cpp:493
#8 0x00000000005317b7 in game::plmove (this=0x7ffff7ed0010, x=62, y=67)
at game.cpp:5242
#9 0x00000000005150fb in game::get_input (this=0x7ffff7ed0010)
at game.cpp:1125
#10 0x0000000000512a1e in game::do_turn (this=0x7ffff7ed0010) at game.cpp:643
#11 0x000000000065c21e in main (argc=1, argv=0x7fffffffe738) at main.cpp:37