From 69f49f79e4e2c8ee7d611fb6e5a5212fd8020132 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 5 Feb 2025 23:29:43 +0100 Subject: [DYNAREC] Fixed a potential SEGFAULT in FindDynablockFromNativeAddress, and added aprofile for BeamNG.drive linux version (for #424) --- src/custommem.c | 6 ++++-- system/box64.box64rc | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/custommem.c b/src/custommem.c index 6846b77b..87328bc1 100644 --- a/src/custommem.c +++ b/src/custommem.c @@ -812,8 +812,10 @@ dynablock_t* FindDynablockFromNativeAddress(void* p) uintptr_t addr = (uintptr_t)p; mapchunk_t* bl = (mapchunk_t*)rb_get_64(rbt_dynmem, (uintptr_t)p); - if(bl) - return *(dynablock_t**)rb_get_64(bl->tree, (uintptr_t)p); + if(bl) { + dynablock_t** ret = (dynablock_t**)rb_get_64(bl->tree, (uintptr_t)p); + if(ret) return *ret; + } return NULL; } diff --git a/system/box64.box64rc b/system/box64.box64rc index bf405f1b..e5ca48f0 100644 --- a/system/box64.box64rc +++ b/system/box64.box64rc @@ -97,6 +97,10 @@ BOX64_PREFER_EMULATED=1 BOX64_LOG=0 BOX64_DYNAREC_ALIGNED_ATOMICS=1 +[BeamNG.drive.x64] +BOX64_MALLOC_HACK=2 +BOX64_DYNAREC_CALLRET=1 + [box64-bash] # LOG tend to mess up script execution in bash BOX64_LOG=0 -- cgit 1.4.1