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

ub when starting match with ai: store to misaligned address #4399

Open
matthiaskrgr opened this issue Oct 23, 2020 · 0 comments
Open

ub when starting match with ai: store to misaligned address #4399

matthiaskrgr opened this issue Oct 23, 2020 · 0 comments
Labels
bug Something isn't working memory & performance Fix bottlenecks, memory leaks, ASan, ...

Comments

@matthiaskrgr
Copy link

Please fill out the relevant sections below and delete the rest.

Describe the bug
When I start game against the default AI I get these UBSAN warnings build with -fsanitize=undefined and launch UBSAN_OPTIONS=print_stacktrace=1 ./widelands for backtraces:

/home/matthias/vcs/github/widelands/src/base/md5.cc:81:2: runtime error: store to misaligned address 0x7ffc89449a09 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x7ffc89449a09: note: pointer points here
 56 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 e2 76 17 c1 7b 1a 19  ab 2d 8a 5f 4d
              ^
    #0 0x563c17cc63dc in md5_finish_ctx(Md5Ctx*, void*) /home/matthias/vcs/github/widelands/src/base/md5.cc:81:36
    #1 0x563c1659e891 in Widelands::Game::get_sync_hash() const /home/matthias/vcs/github/widelands/src/logic/game.cc:700:7
    #2 0x563c16675dac in Widelands::CmdReplaySyncWrite::execute(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/replay.cc:208:23
    #3 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #4 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #5 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #6 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #7 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #8 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #9 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #10 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #11 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #12 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #13 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #14 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #15 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/base/md5.cc:81:2 in
/home/matthias/vcs/github/widelands/src/base/md5.cc:82:2: runtime error: store to misaligned address 0x7ffc89449a0d for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x7ffc89449a0d: note: pointer points here
 c1 7b 1a 19 00 00 00  00 00 00 00 00 00 00 00  00 e2 76 17 c1 7b 1a 19  ab 2d 8a 5f 4d 5b eb 38  dd
             ^
    #0 0x563c17cc62f4 in md5_finish_ctx(Md5Ctx*, void*) /home/matthias/vcs/github/widelands/src/base/md5.cc:82:36
    #1 0x563c1659e891 in Widelands::Game::get_sync_hash() const /home/matthias/vcs/github/widelands/src/logic/game.cc:700:7
    #2 0x563c16675dac in Widelands::CmdReplaySyncWrite::execute(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/replay.cc:208:23
    #3 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #4 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #5 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #6 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #7 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #8 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #9 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #10 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #11 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #12 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #13 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #14 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #15 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/base/md5.cc:82:2 in
/home/matthias/vcs/github/widelands/src/base/md5.cc:83:2: runtime error: store to misaligned address 0x7ffc89449a11 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x7ffc89449a11: note: pointer points here
 ab 2d 8a  5f 00 00 00 00 00 00 00  00 e2 76 17 c1 7b 1a 19  ab 2d 8a 5f 4d 5b eb 38  dd fd 7c 63 9d
              ^
    #0 0x563c17cc6357 in md5_finish_ctx(Md5Ctx*, void*) /home/matthias/vcs/github/widelands/src/base/md5.cc:83:36
    #1 0x563c1659e891 in Widelands::Game::get_sync_hash() const /home/matthias/vcs/github/widelands/src/logic/game.cc:700:7
    #2 0x563c16675dac in Widelands::CmdReplaySyncWrite::execute(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/replay.cc:208:23
    #3 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #4 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #5 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #6 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #7 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #8 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #9 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #10 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #11 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #12 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #13 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #14 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #15 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/base/md5.cc:83:2 in
/home/matthias/vcs/github/widelands/src/base/md5.cc:84:2: runtime error: store to misaligned address 0x7ffc89449a15 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x7ffc89449a15: note: pointer points here
 4d 5b eb 38 00 00 00  00 e2 76 17 c1 7b 1a 19  ab 2d 8a 5f 4d 5b eb 38  dd fd 7c 63 9d 4e 00 00  00
             ^
    #0 0x563c17cc63b1 in md5_finish_ctx(Md5Ctx*, void*) /home/matthias/vcs/github/widelands/src/base/md5.cc:84:36
    #1 0x563c1659e891 in Widelands::Game::get_sync_hash() const /home/matthias/vcs/github/widelands/src/logic/game.cc:700:7
    #2 0x563c16675dac in Widelands::CmdReplaySyncWrite::execute(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/replay.cc:208:23
    #3 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #4 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #5 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #6 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #7 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #8 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #9 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #10 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #11 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #12 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #13 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #14 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #15 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/base/md5.cc:84:2 in
/home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:909:3: runtime error: store to misaligned address 0x7f160fc4e522 for type 'Widelands::Bob *', which requires 8 byte alignment
0x7f160fc4e522: note: pointer points here
 01 00  01 00 00 35 15 00 10 61  00 00 00 00 00 00 00 00  00 00 24 24 00 00 00 00  00 00 00 00 00 00
              ^
    #0 0x563c16fbaae7 in Widelands::Bob::set_position(Widelands::EditorGameBase&, Widelands::Coords const&) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:909:15
    #1 0x563c16fc6704 in Widelands::Bob::start_walk(Widelands::Game&, Widelands::WalkingDir, unsigned int, bool) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:861:2
    #2 0x563c16fc5693 in Widelands::Bob::start_task_move(Widelands::Game&, int, DirAnimations const&, bool) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:696:5
    #3 0x563c16fc2154 in Widelands::Bob::movepath_update(Widelands::Game&, Widelands::Bob::State&) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:677:9
    #4 0x563c16fbdd7d in Widelands::Bob::do_act(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:194:2
    #5 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #6 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #7 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #8 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #9 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #10 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #11 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #12 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #13 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #14 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #15 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #16 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #17 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

game @ dadeaec

@matthiaskrgr matthiaskrgr added the bug Something isn't working label Oct 23, 2020
@Noordfrees Noordfrees added the memory & performance Fix bottlenecks, memory leaks, ASan, ... label Oct 23, 2020
@Noordfrees Noordfrees added this to the v1.0 milestone Oct 23, 2020
@Noordfrees Noordfrees removed this from the v1.0 milestone Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working memory & performance Fix bottlenecks, memory leaks, ASan, ...
Projects
None yet
Development

No branches or pull requests

2 participants