==13418==ERROR: AddressSanitizer: heap-use-after-free on address 0x00011d412a38 at pc 0x000100775ccc bp 0x00016fd61760 sp 0x00016fd61758 READ of size 4 at 0x00011d412a38 thread T0 #0 0x100775cc8 in Saga::HitZone::getFlags() const objectmap.h:56 #1 0x1006ec924 in Saga::Actor::stepZoneAction(Saga::ActorData*, Saga::HitZone const*, bool, bool) actor.cpp:551 #2 0x100712a0c in Saga::Actor::handleActions(int, bool) actor_walk.cpp:695 #3 0x10071da30 in Saga::Actor::direct(int) actor_walk.cpp:727 #4 0x1007d2f48 in Saga::SagaEngine::run() saga.cpp:357 #5 0x1000dc7e0 in runGame(Plugin const*, Plugin const*, OSystem&, Common::String const&) main.cpp:318 #6 0x1000d8130 in scummvm_main main.cpp:619 #7 0x1000cf19c in main macosx-main.cpp:44 #8 0x1024b1088 in start+0x204 (dyld:arm64e+0x5088) 0x00011d412a38 is located 40 bytes inside of 80-byte region [0x00011d412a10,0x00011d412a60) freed by thread T0 here: #0 0x102bd2de4 in wrap_free+0x98 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3ede4) #1 0x1007f6284 in Common::Array::freeStorage(Saga::HitZone*, unsigned int) array.h:414 #2 0x1007af720 in Common::Array::clear() array.h:278 #3 0x1007af660 in Saga::ObjectMap::clear() objectmap.cpp:187 #4 0x1007e888c in Saga::Scene::endScene() scene.cpp:1145 #5 0x1007eb1fc in Saga::Scene::changeScene(short, int, Saga::SceneTransitionType, int) scene.cpp:482 #6 0x100811e70 in Saga::Script::sfScriptGotoScene(Saga::ScriptThread*, int, bool&) sfuncs.cpp:469 #7 0x1007fc4cc in Saga::Script::opCcallV(Saga::ScriptThread*, Common::SeekableReadStream*, bool&, bool&) script.cpp:467 #8 0x100834b00 in Saga::Script::runThread(Saga::ScriptThread&) sthread.cpp:210 #9 0x100833e40 in Saga::Script::executeThreads(unsigned int) sthread.cpp:158 #10 0x1007d2fcc in Saga::SagaEngine::run() saga.cpp:361 #11 0x1000dc7e0 in runGame(Plugin const*, Plugin const*, OSystem&, Common::String const&) main.cpp:318 #12 0x1000d8130 in scummvm_main main.cpp:619 #13 0x1000cf19c in main macosx-main.cpp:44 #14 0x1024b1088 in start+0x204 (dyld:arm64e+0x5088) previously allocated by thread T0 here: #0 0x102bd2ca8 in wrap_malloc+0x94 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3eca8) #1 0x1007b00f0 in Common::Array::allocCapacity(unsigned int) array.h:402 #2 0x1007afee0 in Common::Array::reserve(unsigned int) array.h:358 #3 0x1007af2ec in Common::Array::resize(unsigned int) array.h:369 #4 0x1007af058 in Saga::ObjectMap::load(Saga::ByteArray const&) objectmap.cpp:178 #5 0x1007ef1ac in Saga::Scene::processSceneResources(Common::Array&) scene.cpp:994 #6 0x1007e4b58 in Saga::Scene::loadScene(Saga::LoadSceneParams&) scene.cpp:663 #7 0x1007eb20c in Saga::Scene::changeScene(short, int, Saga::SceneTransitionType, int) scene.cpp:485 #8 0x100811e70 in Saga::Script::sfScriptGotoScene(Saga::ScriptThread*, int, bool&) sfuncs.cpp:469 #9 0x1007fc4cc in Saga::Script::opCcallV(Saga::ScriptThread*, Common::SeekableReadStream*, bool&, bool&) script.cpp:467 #10 0x100834b00 in Saga::Script::runThread(Saga::ScriptThread&) sthread.cpp:210 #11 0x100833e40 in Saga::Script::executeThreads(unsigned int) sthread.cpp:158 #12 0x1007d2fcc in Saga::SagaEngine::run() saga.cpp:361 #13 0x1000dc7e0 in runGame(Plugin const*, Plugin const*, OSystem&, Common::String const&) main.cpp:318 #14 0x1000d8130 in scummvm_main main.cpp:619 #15 0x1000cf19c in main macosx-main.cpp:44 #16 0x1024b1088 in start+0x204 (dyld:arm64e+0x5088) SUMMARY: AddressSanitizer: heap-use-after-free objectmap.h:56 in Saga::HitZone::getFlags() const Shadow bytes around the buggy address: 0x007023aa24f0: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd 0x007023aa2500: fd fd fd fd fd fa fa fa fa fa fd fd fd fd fd fd 0x007023aa2510: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fd 0x007023aa2520: fd fa fa fa fa fa fd fd fd fd fd fd fd fd fd fa 0x007023aa2530: fa fa fa fa fd fd fd fd fd fd fd fd fd fa fa fa =>0x007023aa2540: fa fa fd fd fd fd fd[fd]fd fd fd fd fa fa fa fa 0x007023aa2550: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fd fd 0x007023aa2560: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd 0x007023aa2570: fd fd fd fd fd fa fa fa fa fa fd fd fd fd fd fd 0x007023aa2580: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fd 0x007023aa2590: fd fa fa fa fa fa fd fd fd fd fd fd fd fd fd fa 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 ==13418==ABORTING Abort trap: 6