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

arm64: AddressSanitizer: container-overflow on address #33

Open
Try opened this issue Nov 6, 2022 · 4 comments
Open

arm64: AddressSanitizer: container-overflow on address #33

Try opened this issue Nov 6, 2022 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Try
Copy link
Contributor

Try commented Nov 6, 2022

Run into this issue, when testing latest OpenGothic build on M1.
Apart from it, game runs fine, if detect_container_overflow is disabled. Failure is quite consistent in trigger_list parse code, yet I wasn't able to spot any suspicius code in relevant places.

Full log is below:

GPU = Apple M1
Depth format = 13 Shadow format = 13
[phoenix] world: parsing object [MeshAndBsp % 0 0]
[phoenix] bsp_tree: parsing chunk C000
[phoenix] bsp_tree: parsing chunk C010
[phoenix] bsp_tree: parsing chunk C040
[phoenix] bsp_tree: parsing chunk C045
[phoenix] bsp_tree: parsing chunk C050
[phoenix] bsp_tree: parsing chunk C0FF
[phoenix] mesh: 1 bytes remaining in section 0xB020
[phoenix] world: parsing object [VobTree % 0 0]
=================================================================
==89736==ERROR: AddressSanitizer: container-overflow on address 0x0002cdc006a0 at pc 0x0001051a1c60 bp 0x0002c142faa0 sp 0x0002c142f258
WRITE of size 24 at 0x0002cdc006a0 thread T8
    #0 0x1051a1c5c in __asan_memcpy+0x240 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3dc5c)
    #1 0x1014a0cdc in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) string:1999
    #2 0x1014a0c2c in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) string:2000
    #3 0x1014a0a88 in phoenix::vobs::trigger_list::target::target(phoenix::vobs::trigger_list::target&&) trigger.hh:95
    #4 0x1014a0994 in phoenix::vobs::trigger_list::target::target(phoenix::vobs::trigger_list::target&&) trigger.hh:95
    #5 0x1014a0928 in phoenix::vobs::trigger_list::target* std::__1::construct_at<phoenix::vobs::trigger_list::target, phoenix::vobs::trigger_list::target, phoenix::vobs::trigger_list::target*>(phoenix::vobs::trigger_list::target*, phoenix::vobs::trigger_list::target&&) construct_at.h:37
    #6 0x10149fe14 in void std::__1::allocator_traits<std::__1::allocator<phoenix::vobs::trigger_list::target> >::construct<phoenix::vobs::trigger_list::target, phoenix::vobs::trigger_list::target, void, void>(std::__1::allocator<phoenix::vobs::trigger_list::target>&, phoenix::vobs::trigger_list::target*, phoenix::vobs::trigger_list::target&&) allocator_traits.h:298
    #7 0x10149f260 in void std::__1::vector<phoenix::vobs::trigger_list::target, std::__1::allocator<phoenix::vobs::trigger_list::target> >::__construct_one_at_end<phoenix::vobs::trigger_list::target>(phoenix::vobs::trigger_list::target&&) vector:948
    #8 0x1014945c0 in phoenix::vobs::trigger_list::target& std::__1::vector<phoenix::vobs::trigger_list::target, std::__1::allocator<phoenix::vobs::trigger_list::target> >::emplace_back<phoenix::vobs::trigger_list::target>(phoenix::vobs::trigger_list::target&&) vector:1706
    #9 0x101494218 in phoenix::vobs::trigger_list::parse(phoenix::vobs::trigger_list&, phoenix::archive_reader&, phoenix::game_version) trigger.cc:60
    #10 0x1015c9f00 in phoenix::parse_vob_tree(phoenix::archive_reader&, phoenix::game_version) vob_tree.cc:180
    #11 0x1015cc840 in phoenix::parse_vob_tree(phoenix::archive_reader&, phoenix::game_version) vob_tree.cc:251
    #12 0x1015cc840 in phoenix::parse_vob_tree(phoenix::archive_reader&, phoenix::game_version) vob_tree.cc:251
    #13 0x101566cec in phoenix::world::parse(phoenix::buffer&, phoenix::game_version) world.cc:88
    #14 0x1006374b8 in World::World(GameSession&, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<void (int)>) world.cpp:75
    #15 0x100638020 in World::World(GameSession&, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<void (int)>) world.cpp:64
    #16 0x1002d4418 in GameSession::GameSession(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) gamesession.cpp:62
    #17 0x1002d4ffc in GameSession::GameSession(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) gamesession.cpp:55
    #18 0x1004e25d0 in MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) const mainwindow.cpp:866
    #19 0x1004e251c in decltype(static_cast<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&>(fp)(static_cast<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >>(fp0))) std::__1::__invoke<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > >(MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) type_traits:3918
    #20 0x1004e24c4 in std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > std::__1::__invoke_void_return_wrapper<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >, false>::__call<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > >(MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) invoke.h:30
    #21 0x1004e2464 in std::__1::__function::__alloc_func<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0, std::__1::allocator<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0>, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) function.h:178
    #22 0x1004e0e88 in std::__1::__function::__func<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0, std::__1::allocator<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0>, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) function.h:352
    #23 0x100338994 in std::__1::__function::__value_func<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) const function.h:505
    #24 0x1003386a8 in std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) const function.h:1182
    #25 0x100338308 in Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0::operator()() const gothic.cpp:417
    #26 0x100338244 in decltype(static_cast<Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0>(fp)()) std::__1::__invoke<Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0>(Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0&&) type_traits:3918
    #27 0x1003381e0 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0>&, std::__1::__tuple_indices<>) thread:287
    #28 0x1003378e0 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0> >(void*) thread:298
    #29 0x1861a94e8 in _pthread_start+0x90 (libsystem_pthread.dylib:arm64e+0x74e8)
    #30 0x1861a42cc in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x22cc)

0x0002cdc006a0 is located 96 bytes inside of 128-byte region [0x0002cdc00640,0x0002cdc006c0)
allocated by thread T8 here:

    #0 0x1051b0bd8 in wrap__Znwm+0x74 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4cbd8)
    #1 0x10149d8fc in void* std::__1::__libcpp_operator_new<unsigned long>(unsigned long) new:235
    #2 0x10149d6ec in std::__1::__libcpp_allocate(unsigned long, unsigned long) new:261
    #3 0x1014a2da4 in std::__1::allocator<phoenix::vobs::trigger_list::target>::allocate(unsigned long) allocator.h:108
    #4 0x1014a2768 in std::__1::allocator_traits<std::__1::allocator<phoenix::vobs::trigger_list::target> >::allocate(std::__1::allocator<phoenix::vobs::trigger_list::target>&, unsigned long) allocator_traits.h:262
    #5 0x1014a2378 in std::__1::__split_buffer<phoenix::vobs::trigger_list::target, std::__1::allocator<phoenix::vobs::trigger_list::target>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<phoenix::vobs::trigger_list::target>&) __split_buffer:315
    #6 0x1014a18f0 in std::__1::__split_buffer<phoenix::vobs::trigger_list::target, std::__1::allocator<phoenix::vobs::trigger_list::target>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<phoenix::vobs::trigger_list::target>&) __split_buffer:314
    #7 0x10149f71c in void std::__1::vector<phoenix::vobs::trigger_list::target, std::__1::allocator<phoenix::vobs::trigger_list::target> >::__emplace_back_slow_path<phoenix::vobs::trigger_list::target>(phoenix::vobs::trigger_list::target&&) vector:1687
    #8 0x101494644 in phoenix::vobs::trigger_list::target& std::__1::vector<phoenix::vobs::trigger_list::target, std::__1::allocator<phoenix::vobs::trigger_list::target> >::emplace_back<phoenix::vobs::trigger_list::target>(phoenix::vobs::trigger_list::target&&) vector:1709
    #9 0x101494218 in phoenix::vobs::trigger_list::parse(phoenix::vobs::trigger_list&, phoenix::archive_reader&, phoenix::game_version) trigger.cc:60
    #10 0x1015c9f00 in phoenix::parse_vob_tree(phoenix::archive_reader&, phoenix::game_version) vob_tree.cc:180
    #11 0x1015cc840 in phoenix::parse_vob_tree(phoenix::archive_reader&, phoenix::game_version) vob_tree.cc:251
    #12 0x1015cc840 in phoenix::parse_vob_tree(phoenix::archive_reader&, phoenix::game_version) vob_tree.cc:251
    #13 0x101566cec in phoenix::world::parse(phoenix::buffer&, phoenix::game_version) world.cc:88
    #14 0x1006374b8 in World::World(GameSession&, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<void (int)>) world.cpp:75
    #15 0x100638020 in World::World(GameSession&, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<void (int)>) world.cpp:64
    #16 0x1002d4418 in GameSession::GameSession(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) gamesession.cpp:62
    #17 0x1002d4ffc in GameSession::GameSession(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) gamesession.cpp:55
    #18 0x1004e25d0 in MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) const mainwindow.cpp:866
    #19 0x1004e251c in decltype(static_cast<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&>(fp)(static_cast<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >>(fp0))) std::__1::__invoke<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > >(MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) type_traits:3918
    #20 0x1004e24c4 in std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > std::__1::__invoke_void_return_wrapper<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >, false>::__call<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > >(MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) invoke.h:30
    #21 0x1004e2464 in std::__1::__function::__alloc_func<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0, std::__1::allocator<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0>, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) function.h:178
    #22 0x1004e0e88 in std::__1::__function::__func<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0, std::__1::allocator<MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0>, std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) function.h:352
    #23 0x100338994 in std::__1::__function::__value_func<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) const function.h:505
    #24 0x1003386a8 in std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>::operator()(std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&) const function.h:1182
    #25 0x100338308 in Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0::operator()() const gothic.cpp:417
    #26 0x100338244 in decltype(static_cast<Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0>(fp)()) std::__1::__invoke<Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0>(Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0&&) type_traits:3918
    #27 0x1003381e0 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0>&, std::__1::__tuple_indices<>) thread:287
    #28 0x1003378e0 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0> >(void*) thread:298
    #29 0x1861a94e8 in _pthread_start+0x90 (libsystem_pthread.dylib:arm64e+0x74e8)

Thread T8 created by T0 here:

    #0 0x10519df58 in wrap_pthread_create+0x54 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x39f58)
    #1 0x100337880 in std::__1::__libcpp_thread_create(_opaque_pthread_t**, void* (*)(void*), void*) __threading_support:421
    #2 0x100337638 in std::__1::thread::thread<Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0, void>(Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0&&) thread:314
    #3 0x100322e80 in std::__1::thread::thread<Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0, void>(Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>)::$_0&&) thread:306
    #4 0x100322c64 in Gothic::implStartLoadSave(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>) gothic.cpp:411
    #5 0x100322dc0 in Gothic::startLoad(std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::function<std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> > (std::__1::unique_ptr<GameSession, std::__1::default_delete<GameSession> >&&)>) gothic.cpp:393
    #6 0x1004d3888 in MainWindow::startGame(std::__1::basic_string_view<char, std::__1::char_traits<char> >) mainwindow.cpp:864
    #7 0x1004d2ce8 in MainWindow::MainWindow(Tempest::Device&) mainwindow.cpp:75
    #8 0x1004d43d8 in MainWindow::MainWindow(Tempest::Device&) mainwindow.cpp:35
    #9 0x1004cc964 in main main.cpp:107
    #10 0x104ca50f0 in start+0x204 (dyld:arm64e+0x50f0)

HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_container_overflow=0.
If you suspect a false positive see also: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow.

SUMMARY: AddressSanitizer: container-overflow (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3dc5c) in __asan_memcpy+0x240
Shadow bytes around the buggy address:
  0x007059ba0080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x007059ba0090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x007059ba00a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x007059ba00b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x007059ba00c0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
=>0x007059ba00d0: 00 00 00 00[fc]fc fc fc fa fa fa fa fa fa fa fa
  0x007059ba00e0: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fa
  0x007059ba00f0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x007059ba0100: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa
  0x007059ba0110: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x007059ba0120: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==89736==ABORTING
@lmichaelis
Copy link
Member

Yeah I've had that problem it my GitHub Workflow too. GCC and Clang both compile and run fine with sanitizers so I doubt there is anything wrong at all. I'm not sure about that though, so if you'd like to it would help if you could debug it and see if it's actually a bigger issue. Otherwise I'll just assume it's a problem with sanitizer support on Apple Clang (since this issue can occur if parts of the app are instrumented and others are not).

@lmichaelis lmichaelis added the question Further information is requested label Nov 9, 2022
@lmichaelis lmichaelis added this to the v1.1.0 milestone Nov 9, 2022
@lmichaelis lmichaelis added bug Something isn't working help wanted Extra attention is needed labels Nov 9, 2022
@Try
Copy link
Contributor Author

Try commented Nov 13, 2022

Hit possibly another sanitizer issue:

// MSVC
error LNK2038: mismatch detected for 'annotate_vector': value '1' doesn't match value '0' in

Apparently MSVC+Jom cannot link project if different sanitize options were in use, by different submodules. MSVC+Ninja somehow works, not sure why.

Suggestion: advice top-level application(OpenGothc) to use global settings instead:

add_compile_options(-fsanitize=address)
add_compile_options(-fsanitize=leak)
add_link_options   (-fsanitize=address)
add_link_options   (-fsanitize=leak)

@lmichaelis
Copy link
Member

lmichaelis commented Nov 14, 2022

It is already possible to disable sanitizer flags in phoenix. You can just set(PHOENIX_DISABLE_SANITIZERS ON) and define your own sanitizers globally if you'd like.

@lmichaelis lmichaelis removed the question Further information is requested label Nov 14, 2022
@Try
Copy link
Contributor Author

Try commented Nov 15, 2022

Tested on mac after switching to global-level sanitizers. Setup in OpenGothic cmake:

# in debug mode, enable sanitizers
set(PHOENIX_DISABLE_SANITIZERS ON  CACHE INTERNAL "")
...
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
  add_compile_options(-fsanitize=address)
  add_compile_options(-fsanitize=leak)
  add_link_options   (-fsanitize=address)
  add_link_options   (-fsanitize=leak)
endif()

Now warning are gone

@lmichaelis lmichaelis removed this from the v1.1.0 milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants