wheybags / freeablo

[ARCHIVED] Modern reimplementation of the Diablo 1 game engine
GNU General Public License v3.0
2.16k stars 193 forks source link

Crashes when clicked outside of map #379

Closed akuskis closed 5 years ago

akuskis commented 6 years ago

How to reproduce: Click outside of map. selection_010

Stack trace:

raise 0x00007f468f4f8e97
abort 0x00007f468f4fa801
Misc::Array2D<int>::get array2d.h:53
Level::Dun::get dun.h:32
Level::Level::activate level.cpp:148
FAWorld::GameLevel::activate gamelevel.cpp:71
FAWorld::PlayerBehaviour::addInput playerbehaviour.cpp:54
FAWorld::World::update world.cpp:313
Engine::EngineMain::runGameLoop enginemain.cpp:177
std::__invoke_impl<void, void (Engine::EngineMain::*&)(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), Engine::EngineMain*&, boost::program_options::variables_map const*&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> invoke.h:73
std::__invoke<void (Engine::EngineMain::*&)(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), Engine::EngineMain*&, boost::program_options::variables_map const*&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> invoke.h:95
std::_Bind<void (Engine::EngineMain::*(Engine::EngineMain*, boost::program_options::variables_map const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::__call<void, , 0ul, 1ul, 2ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul, 2ul>) functional:467
std::_Bind<void (Engine::EngineMain::*(Engine::EngineMain*, boost::program_options::variables_map const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()<, void>() functional:551
std::__invoke_impl<void, std::_Bind<void (Engine::EngineMain::*(Engine::EngineMain*, boost::program_options::variables_map const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>>(std::__invoke_other, std::_Bind<void (Engine::EngineMain::*(Engine::EngineMain*, boost::program_options::variables_map const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&&) invoke.h:60
std::__invoke<std::_Bind<void (Engine::EngineMain::*(Engine::EngineMain*, boost::program_options::variables_map const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>>(std::_Bind<void (Engine::EngineMain::*(Engine::EngineMain*, boost::program_options::variables_map const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&&) invoke.h:95
std::thread::_Invoker<std::tuple<std::_Bind<void (Engine::EngineMain::*(Engine::EngineMain*, boost::program_options::variables_map const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > >::_M_invoke<0ul>(std::_Index_tuple<0ul>) thread:234
std::thread::_Invoker<std::tuple<std::_Bind<void (Engine::EngineMain::*(Engine::EngineMain*, boost::program_options::variables_map const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > >::operator()() thread:243
std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Bind<void (Engine::EngineMain::*(Engine::EngineMain*, boost::program_options::variables_map const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))(boost::program_options::variables_map const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > > >::_M_run() thread:186
<unknown> 0x00007f469013e733
start_thread 0x00007f468f8b26db
clone 0x00007f468f5db88f

In "array2d.h", function "get" is called with "x" and "y" values, which are outside of map.

wheybags commented 6 years ago

A decent fix for this would probably just be to ignore out of bounds clicks.

tilkinsc commented 5 years ago

I just wanted to point out the irony in the fact this issue is #404