Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault on map open or after few moves #29472

Closed
Xelat84 opened this issue Apr 11, 2019 · 1 comment · Fixed by #29487
Closed

Segfault on map open or after few moves #29472

Xelat84 opened this issue Apr 11, 2019 · 1 comment · Fixed by #29487
Labels
<Crash / Freeze> Fatal bug that results in hangs or crashes. (S1 - Need confirmation) Report waiting on confirmation of reproducibility

Comments

@Xelat84
Copy link
Contributor

Xelat84 commented Apr 11, 2019

Describe the bug
Game just crash when I open map (press 'm'), or make few moves.

VERSION: 0.D-1679-gdd4532a
TYPE: Signal
MESSAGE: SIGSEGV: Segmentation fault
STACK TRACE:
    @0x5583A5[cataclysm-tiles.exe+0x1583A5]
    @0x558F52[cataclysm-tiles.exe+0x158F52]
    SMPEG_error+0x4B034@0xE3F030[cataclysm-tiles.exe+0xA3F030]
    _C_specific_handler+0x9C@0x77BB85A8[ntdll.dll+0x185A8]
    RtlDecodePointer+0xBD@0x77BC9D0D[ntdll.dll+0x29D0D]
    RtlUnwindEx+0xBBF@0x77BB91AF[ntdll.dll+0x191AF]
    KiUserExceptionDispatcher+0x2E@0x77BF1278[ntdll.dll+0x51278]
    @0xAF2221[cataclysm-tiles.exe+0x6F2221]
    @0xAF7CCD[cataclysm-tiles.exe+0x6F7CCD]
    @0xAFF2FB[cataclysm-tiles.exe+0x6FF2FB]
    @0x69C468[cataclysm-tiles.exe+0x29C468]
    @0x6800C7[cataclysm-tiles.exe+0x2800C7]
    IMG_LoadWEBP_RW+0x4E16C9@0x1412569[cataclysm-tiles.exe+0x1012569]
    @0x4013ED[cataclysm-tiles.exe+0x13ED]
    @0x4014FB[cataclysm-tiles.exe+0x14FB]
    BaseThreadInitThunk+0xD@0x77A9652D[kernel32.dll+0x1652D]
    RtlUserThreadStart+0x21@0x77BCC521[ntdll.dll+0x2C521]

To Reproduce
I provide my savegame and config folder, so it's enough to load that savegame and press 'm'.

Versions and configuration(please complete the following information):

  • OS: Windows 7 x64
  • Game Version: 0.D-1679-gdd4532a
  • Graphics version: Tiles
  • Mods loaded: [ "dda", "no_npc_food", "novitamins", "More_Survival_Tools", "mutant_npcs", "national_guard_camp", "more_locations", "Urban_Development", "boats", "blazemod", "Tanks", "no_olg_guns", "no_religious_Texts", "no_reviving_zombies", "realguns", "growable-pots", "modular_turrets", "Salvaged_Robots", "FujiStruct" ]

Additional context
Link to a savegame: https://yadi.sk/d/gJvEHkncdmGOMg

@Night-Pryanik Night-Pryanik added (S1 - Need confirmation) Report waiting on confirmation of reproducibility <Crash / Freeze> Fatal bug that results in hangs or crashes. labels Apr 12, 2019
@neitsa
Copy link
Contributor

neitsa commented Apr 12, 2019

Thanks @Xelat84 for your bug report! The crash can be easily reproduced with your save file.

Stack trace (lines may not be totally accurate, my build is some PRs behind master):

>	Cataclysm.exe!`anonymous namespace'::draw(const catacurses::window & w, const catacurses::window & wbar, const tripoint & center, const tripoint & orig, bool blink, bool show_explored, bool fast_scroll, input_context * inp_ctxt, const `anonymous-namespace'::draw_data_t & data) Line 513	C++
 	Cataclysm.exe!`anonymous namespace'::display(const tripoint & orig, const `anonymous-namespace'::draw_data_t & data) Line 968	C++
 	Cataclysm.exe!ui::omap::display() Line 1330	C++
 	Cataclysm.exe!game::handle_action() Line 1805	C++
 	Cataclysm.exe!game::do_turn() Line 1401	C++
 	Cataclysm.exe!SDL_main(int argc, char * * argv) Line 682	C++
 	Cataclysm.exe!main_getcmdline(...) Line 177	C
 	[External Code]	

In overmap_ui.cpp; draw function; line 506:

        std::vector<npc *> followers;
        for( auto &elem : g->get_follower_list() ) {
            std::shared_ptr<npc> npc_to_get = overmap_buffer.find_npc( elem );
            npc *npc_to_add = npc_to_get.get(); // returns nullptr
            followers.push_back( npc_to_add ); // push nullptr
        }
        for( const auto &np : followers ) {
            if( np->posz() != z ) {      // **crash** here because np = nullptr
                continue;
            }

It seems that npc *npc_to_add = npc_to_get.get(); returns null pointers, so followers is filled with one or multiple nullptr and the next range-based for loop iterates on nullptr, giving a crash on np->posz().

>? g->get_follower_list()
{ size=2 }
    [capacity]: 2
    [allocator]: allocator
    [0]: 90
    [1]: 28
    [Raw View]: {...}

> ? followers
{ size=2 }
    [capacity]: 2
    [allocator]: allocator
    [0]: 0x0000000000000000 <NULL>
    [1]: 0x0000000000000000 <NULL>
    [Raw View]: {...}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Crash / Freeze> Fatal bug that results in hangs or crashes. (S1 - Need confirmation) Report waiting on confirmation of reproducibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants