{"action":"closed","issue":{"url":"https://api.github.com/repos/Andrettin/Wyrmgus/issues/21","labels_url":"https://api.github.com/repos/Andrettin/Wyrmgus/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/Andrettin/Wyrmgus/issues/21/comments","events_url":"https://api.github.com/repos/Andrettin/Wyrmgus/issues/21/events","html_url":"https://github.com/Andrettin/Wyrmgus/issues/21","id":85055401,"number":21,"title":"RemoveUnit crash","user":{"login":"Szunti","id":1443881,"avatar_url":"https://avatars.githubusercontent.com/u/1443881?v=3","gravatar_id":"","url":"https://api.github.com/users/Szunti","html_url":"https://github.com/Szunti","followers_url":"https://api.github.com/users/Szunti/followers","following_url":"https://api.github.com/users/Szunti/following{/other_user}","gists_url":"https://api.github.com/users/Szunti/gists{/gist_id}","starred_url":"https://api.github.com/users/Szunti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Szunti/subscriptions","organizations_url":"https://api.github.com/users/Szunti/orgs","repos_url":"https://api.github.com/users/Szunti/repos","events_url":"https://api.github.com/users/Szunti/events{/privacy}","received_events_url":"https://api.github.com/users/Szunti/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-04T11:39:06Z","updated_at":"2015-06-04T14:12:53Z","closed_at":"2015-06-04T14:12:53Z","body":"I think it means a unit was killed, that wasn't added to a player with AddUnit yet.\r\n\r\n```\r\n=================================================================\r\n==2076==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x619003529178 at pc 0x0000005f5263 bp 0x7ffea3d9de40 sp 0x7ffea3d9de30\r\nWRITE of size 8 at 0x619003529178 thread T0\r\n    #0 0x5f5262 in CPlayer::RemoveUnit(CUnit&) Wyrmgus/src/stratagus/player.cpp:899\r\n    #1 0x6cd603 in UnitLost(CUnit&) Wyrmgus/src/unit/unit.cpp:1450\r\n    #2 0x6cfbfb in LetUnitDie(CUnit&, bool) Wyrmgus/src/unit/unit.cpp:2628\r\n    #3 0x489629 in Feed Wyrmgus/src/action/action_still.cpp:269\r\n    #4 0x489629 in COrder_Still::Execute(CUnit&) Wyrmgus/src/action/action_still.cpp:593\r\n    #5 0x499188 in HandleUnitAction Wyrmgus/src/action/actions.cpp:396\r\n    #6 0x499188 in UnitActionsEachCycle<__gnu_cxx::__normal_iterator<CUnit**, std::vector<CUnit*> > > Wyrmgus/src/action/actions.cpp:487\r\n    #7 0x499188 in UnitActions() Wyrmgus/src/action/actions.cpp:517\r\n    #8 0x5f1610 in GameLogicLoop Wyrmgus/src/stratagus/mainloop.cpp:256\r\n    #9 0x5f1610 in SingleGameLoop Wyrmgus/src/stratagus/mainloop.cpp:390\r\n    #10 0x5f1610 in GameMainLoop() Wyrmgus/src/stratagus/mainloop.cpp:427\r\n    #11 0x506ac5 in StartMap(std::string const&, bool) Wyrmgus/src/game/game.cpp:164\r\n    #12 0x79cc98 in tolua_stratagus_StartMap00 Wyrmgus/build/tolua.cpp:1063\r\n    #13 0x7fbdaa5f11e7  (/usr/lib/liblua5.1.so.5.1+0xc1e7)\r\n    #14 0x7fbdaa5fb92e  (/usr/lib/liblua5.1.so.5.1+0x1692e)\r\n    #15 0x7fbdaa5f162c  (/usr/lib/liblua5.1.so.5.1+0xc62c)\r\n    #16 0x7fbdaa5f091a  (/usr/lib/liblua5.1.so.5.1+0xb91a)\r\n    #17 0x7fbdaa5f17b9  (/usr/lib/liblua5.1.so.5.1+0xc7b9)\r\n    #18 0x7fbdaa5ed57c in lua_pcall (/usr/lib/liblua5.1.so.5.1+0x857c)\r\n    #19 0x5f0455 in LuaCallback::run(int) Wyrmgus/src/stratagus/luacallback.cpp:149\r\n    #20 0x683a65 in LuaActionListener::action(std::string const&) Wyrmgus/src/ui/widgets.cpp:214\r\n    #21 0x52969b in gcn::Widget::generateAction() Wyrmgus/src/guichan/widget.cpp:609\r\n    #22 0x52c0a1 in gcn::Button::mouseClick(int, int, int, int) Wyrmgus/src/guichan/widgets/button.cpp:254\r\n    #23 0x52901a in gcn::Widget::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widget.cpp:495\r\n    #24 0x52ebbe in gcn::Container::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widgets/container.cpp:386\r\n    #25 0x519fcf in gcn::Gui::logic() Wyrmgus/src/guichan/gui.cpp:155\r\n    #26 0x6859f9 in handleInput(SDL_Event const*) Wyrmgus/src/ui/widgets.cpp:169\r\n    #27 0x72a06b in WaitEventsOneFrame() Wyrmgus/src/video/sdl.cpp:981\r\n    #28 0x690286 in MenuScreen::run(bool) Wyrmgus/src/ui/widgets.cpp:2897\r\n    #29 0x7804b1 in tolua_stratagus_CMenuScreen_run00 Wyrmgus/build/tolua.cpp:20941\r\n    #30 0x7fbdaa5f11e7  (/usr/lib/liblua5.1.so.5.1+0xc1e7)\r\n    #31 0x7fbdaa5fb92e  (/usr/lib/liblua5.1.so.5.1+0x1692e)\r\n    #32 0x7fbdaa5f162c  (/usr/lib/liblua5.1.so.5.1+0xc62c)\r\n    #33 0x7fbdaa5f091a  (/usr/lib/liblua5.1.so.5.1+0xb91a)\r\n    #34 0x7fbdaa5f17b9  (/usr/lib/liblua5.1.so.5.1+0xc7b9)\r\n    #35 0x7fbdaa5ed57c in lua_pcall (/usr/lib/liblua5.1.so.5.1+0x857c)\r\n    #36 0x5f0455 in LuaCallback::run(int) Wyrmgus/src/stratagus/luacallback.cpp:149\r\n    #37 0x683a65 in LuaActionListener::action(std::string const&) Wyrmgus/src/ui/widgets.cpp:214\r\n    #38 0x52969b in gcn::Widget::generateAction() Wyrmgus/src/guichan/widget.cpp:609\r\n    #39 0x52c0a1 in gcn::Button::mouseClick(int, int, int, int) Wyrmgus/src/guichan/widgets/button.cpp:254\r\n    #40 0x52901a in gcn::Widget::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widget.cpp:495\r\n    #41 0x52ebbe in gcn::Container::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widgets/container.cpp:386\r\n    #42 0x519fcf in gcn::Gui::logic() Wyrmgus/src/guichan/gui.cpp:155\r\n    #43 0x6859f9 in handleInput(SDL_Event const*) Wyrmgus/src/ui/widgets.cpp:169\r\n    #44 0x72a06b in WaitEventsOneFrame() Wyrmgus/src/video/sdl.cpp:981\r\n    #45 0x690286 in MenuScreen::run(bool) Wyrmgus/src/ui/widgets.cpp:2897\r\n    #46 0x7804b1 in tolua_stratagus_CMenuScreen_run00 Wyrmgus/build/tolua.cpp:20941\r\n    #47 0x7fbdaa5f11e7  (/usr/lib/liblua5.1.so.5.1+0xc1e7)\r\n    #48 0x7fbdaa5fb92e  (/usr/lib/liblua5.1.so.5.1+0x1692e)\r\n    #49 0x7fbdaa5f162c  (/usr/lib/liblua5.1.so.5.1+0xc62c)\r\n    #50 0x7fbdaa5f091a  (/usr/lib/liblua5.1.so.5.1+0xb91a)\r\n    #51 0x7fbdaa5f17b9  (/usr/lib/liblua5.1.so.5.1+0xc7b9)\r\n    #52 0x7fbdaa5ed57c in lua_pcall (/usr/lib/liblua5.1.so.5.1+0x857c)\r\n    #53 0x5f0455 in LuaCallback::run(int) Wyrmgus/src/stratagus/luacallback.cpp:149\r\n    #54 0x683a65 in LuaActionListener::action(std::string const&) Wyrmgus/src/ui/widgets.cpp:214\r\n    #55 0x52969b in gcn::Widget::generateAction() Wyrmgus/src/guichan/widget.cpp:609\r\n    #56 0x52c0a1 in gcn::Button::mouseClick(int, int, int, int) Wyrmgus/src/guichan/widgets/button.cpp:254\r\n    #57 0x52901a in gcn::Widget::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widget.cpp:495\r\n    #58 0x52ebbe in gcn::Container::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widgets/container.cpp:386\r\n    #59 0x519fcf in gcn::Gui::logic() Wyrmgus/src/guichan/gui.cpp:155\r\n    #60 0x6859f9 in handleInput(SDL_Event const*) Wyrmgus/src/ui/widgets.cpp:169\r\n    #61 0x72a06b in WaitEventsOneFrame() Wyrmgus/src/video/sdl.cpp:981\r\n    #62 0x690286 in MenuScreen::run(bool) Wyrmgus/src/ui/widgets.cpp:2897\r\n    #63 0x7804b1 in tolua_stratagus_CMenuScreen_run00 Wyrmgus/build/tolua.cpp:20941\r\n    #64 0x7fbdaa5f11e7  (/usr/lib/liblua5.1.so.5.1+0xc1e7)\r\n    #65 0x7fbdaa5fb898  (/usr/lib/liblua5.1.so.5.1+0x16898)\r\n    #66 0x7fbdaa5f162c  (/usr/lib/liblua5.1.so.5.1+0xc62c)\r\n    #67 0x7fbdaa5f091a  (/usr/lib/liblua5.1.so.5.1+0xb91a)\r\n    #68 0x7fbdaa5f17b9  (/usr/lib/liblua5.1.so.5.1+0xc7b9)\r\n    #69 0x7fbdaa5ed57c in lua_pcall (/usr/lib/liblua5.1.so.5.1+0x857c)\r\n    #70 0x5f0455 in LuaCallback::run(int) Wyrmgus/src/stratagus/luacallback.cpp:149\r\n    #71 0x683a65 in LuaActionListener::action(std::string const&) Wyrmgus/src/ui/widgets.cpp:214\r\n    #72 0x52969b in gcn::Widget::generateAction() Wyrmgus/src/guichan/widget.cpp:609\r\n    #73 0x52c0a1 in gcn::Button::mouseClick(int, int, int, int) Wyrmgus/src/guichan/widgets/button.cpp:254\r\n    #74 0x52901a in gcn::Widget::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widget.cpp:495\r\n    #75 0x52ebbe in gcn::Container::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widgets/container.cpp:386\r\n    #76 0x519fcf in gcn::Gui::logic() Wyrmgus/src/guichan/gui.cpp:155\r\n    #77 0x6859f9 in handleInput(SDL_Event const*) Wyrmgus/src/ui/widgets.cpp:169\r\n    #78 0x72a06b in WaitEventsOneFrame() Wyrmgus/src/video/sdl.cpp:981\r\n    #79 0x690286 in MenuScreen::run(bool) Wyrmgus/src/ui/widgets.cpp:2897\r\n    #80 0x7804b1 in tolua_stratagus_CMenuScreen_run00 Wyrmgus/build/tolua.cpp:20941\r\n    #81 0x7fbdaa5f11e7  (/usr/lib/liblua5.1.so.5.1+0xc1e7)\r\n    #82 0x7fbdaa5fb898  (/usr/lib/liblua5.1.so.5.1+0x16898)\r\n    #83 0x7fbdaa5f162c  (/usr/lib/liblua5.1.so.5.1+0xc62c)\r\n    #84 0x7fbdaa5f091a  (/usr/lib/liblua5.1.so.5.1+0xb91a)\r\n    #85 0x7fbdaa5f17b9  (/usr/lib/liblua5.1.so.5.1+0xc7b9)\r\n    #86 0x7fbdaa5ed57c in lua_pcall (/usr/lib/liblua5.1.so.5.1+0x857c)\r\n    #87 0x5f0455 in LuaCallback::run(int) Wyrmgus/src/stratagus/luacallback.cpp:149\r\n    #88 0x683a65 in LuaActionListener::action(std::string const&) Wyrmgus/src/ui/widgets.cpp:214\r\n    #89 0x52969b in gcn::Widget::generateAction() Wyrmgus/src/guichan/widget.cpp:609\r\n    #90 0x52c0a1 in gcn::Button::mouseClick(int, int, int, int) Wyrmgus/src/guichan/widgets/button.cpp:254\r\n    #91 0x52901a in gcn::Widget::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widget.cpp:495\r\n    #92 0x52ebbe in gcn::Container::_mouseInputMessage(gcn::MouseInput const&) Wyrmgus/src/guichan/widgets/container.cpp:386\r\n    #93 0x519fcf in gcn::Gui::logic() Wyrmgus/src/guichan/gui.cpp:155\r\n    #94 0x6859f9 in handleInput(SDL_Event const*) Wyrmgus/src/ui/widgets.cpp:169\r\n    #95 0x72a06b in WaitEventsOneFrame() Wyrmgus/src/video/sdl.cpp:981\r\n    #96 0x690286 in MenuScreen::run(bool) Wyrmgus/src/ui/widgets.cpp:2897\r\n    #97 0x7804b1 in tolua_stratagus_CMenuScreen_run00 Wyrmgus/build/tolua.cpp:20941\r\n    #98 0x7fbdaa5f11e7  (/usr/lib/liblua5.1.so.5.1+0xc1e7)\r\n    #99 0x7fbdaa5fb898  (/usr/lib/liblua5.1.so.5.1+0x16898)\r\n    #100 0x7fbdaa5f162c  (/usr/lib/liblua5.1.so.5.1+0xc62c)\r\n    #101 0x7fbdaa5f091a  (/usr/lib/liblua5.1.so.5.1+0xb91a)\r\n    #102 0x7fbdaa5f17b9  (/usr/lib/liblua5.1.so.5.1+0xc7b9)\r\n    #103 0x7fbdaa5ed57c in lua_pcall (/usr/lib/liblua5.1.so.5.1+0x857c)\r\n    #104 0x5fc8a5 in LuaCall(int, int, bool) Wyrmgus/src/stratagus/script.cpp:165\r\n    #105 0x601e93 in LuaLoadFile(std::string const&) Wyrmgus/src/stratagus/script.cpp:222\r\n    #106 0x61e9ba in MenuLoop Wyrmgus/src/stratagus/stratagus.cpp:302\r\n    #107 0x61e9ba in stratagusMain(int, char**) Wyrmgus/src/stratagus/stratagus.cpp:784\r\n    #108 0x5f0603 in main Wyrmgus/src/stratagus/main.cpp:37\r\n    #109 0x7fbda784478f in __libc_start_main (/usr/lib/libc.so.6+0x2078f)\r\n    #110 0x45d408 in _start (Wyrmgus/build/stratagus+0x45d408)\r\n\r\n0x619003529178 is located 8 bytes to the left of 1024-byte region [0x619003529180,0x619003529580)\r\nallocated by thread T0 here:\r\n    #0 0x7fbdaa8ab8e2 in operator new(unsigned long) /build/gcc-multilib/src/gcc-5-20150519/libsanitizer/asan/asan_new_delete.cc:60\r\n    #1 0x48ab91 in __gnu_cxx::new_allocator<CUnit*>::allocate(unsigned long, void const*) /usr/include/c++/5.1.0/ext/new_allocator.h:104\r\n    #2 0x48ab91 in std::allocator_traits<std::allocator<CUnit*> >::allocate(std::allocator<CUnit*>&, unsigned long) /usr/include/c++/5.1.0/bits/alloc_traits.h:360\r\n    #3 0x48ab91 in std::_Vector_base<CUnit*, std::allocator<CUnit*> >::_M_allocate(unsigned long) /usr/include/c++/5.1.0/bits/stl_vector.h:170\r\n    #4 0x48ab91 in void std::vector<CUnit*, std::allocator<CUnit*> >::_M_emplace_back_aux<CUnit*>(CUnit*&&) /usr/include/c++/5.1.0/bits/vector.tcc:412\r\n    #5 0x48ad46 in void std::vector<CUnit*, std::allocator<CUnit*> >::emplace_back<CUnit*>(CUnit*&&) /usr/include/c++/5.1.0/bits/vector.tcc:101\r\n    #6 0x5f87e3 in std::vector<CUnit*, std::allocator<CUnit*> >::push_back(CUnit*&&) /usr/include/c++/5.1.0/bits/stl_vector.h:932\r\n    #7 0x5f87e3 in CPlayer::AddUnit(CUnit&) Wyrmgus/src/stratagus/player.cpp:886\r\n    #8 0x6c2ec8 in CUnit::AssignToPlayer(CPlayer&) Wyrmgus/src/unit/unit.cpp:789\r\n    #9 0x6cb03d in MakeUnit(CUnitType const&, CPlayer*) Wyrmgus/src/unit/unit.cpp:848\r\n    #10 0x48f2d2 in COrder_Train::Execute(CUnit&) Wyrmgus/src/action/action_train.cpp:313\r\n    #11 0x499188 in HandleUnitAction Wyrmgus/src/action/actions.cpp:396\r\n    #12 0x499188 in UnitActionsEachCycle<__gnu_cxx::__normal_iterator<CUnit**, std::vector<CUnit*> > > Wyrmgus/src/action/actions.cpp:487\r\n    #13 0x499188 in UnitActions() Wyrmgus/src/action/actions.cpp:517\r\n    #14 0x5f1610 in GameLogicLoop Wyrmgus/src/stratagus/mainloop.cpp:256\r\n    #15 0x5f1610 in SingleGameLoop Wyrmgus/src/stratagus/mainloop.cpp:390\r\n    #16 0x5f1610 in GameMainLoop() Wyrmgus/src/stratagus/mainloop.cpp:427\r\n    #17 0x506ac5 in StartMap(std::string const&, bool) Wyrmgus/src/game/game.cpp:164\r\n    #18 0x79cc98 in tolua_stratagus_StartMap00 Wyrmgus/build/tolua.cpp:1063\r\n    #19 0x7fbdaa5f11e7  (/usr/lib/liblua5.1.so.5.1+0xc1e7)\r\n\r\nSUMMARY: AddressSanitizer: heap-buffer-overflow Wyrmgus/src/stratagus/player.cpp:899 CPlayer::RemoveUnit(CUnit&)\r\nShadow bytes around the buggy address:\r\n  0x0c328069d1d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x0c328069d1e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x0c328069d1f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x0c328069d200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x0c328069d210: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n=>0x0c328069d220: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]\r\n  0x0c328069d230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0c328069d240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0c328069d250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0c328069d260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0c328069d270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\nShadow byte legend (one shadow byte represents 8 application bytes):\r\n  Addressable:           00\r\n  Partially addressable: 01 02 03 04 05 06 07 \r\n  Heap left redzone:       fa\r\n  Heap right redzone:      fb\r\n  Freed heap region:       fd\r\n  Stack left redzone:      f1\r\n  Stack mid redzone:       f2\r\n  Stack right redzone:     f3\r\n  Stack partial redzone:   f4\r\n  Stack after return:      f5\r\n  Stack use after scope:   f8\r\n  Global redzone:          f9\r\n  Global init order:       f6\r\n  Poisoned by user:        f7\r\n  Container overflow:      fc\r\n  Array cookie:            ac\r\n  Intra object redzone:    bb\r\n  ASan internal:           fe\r\n==2076==ABORTING\r\n```"}}