about summary refs log tree commit diff stats
path: root/src/dynarec/dynarec_native.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-06-14 11:31:18 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-06-14 11:31:18 +0200
commitdecec260b2bccc4f3d99eaef0bc68c55bbf2db28 (patch)
tree98316be1f875c917a56aa88b84aa8007b84abc1e /src/dynarec/dynarec_native.c
parentae6ec48623c3684ca60016a9fd4292fbca149292 (diff)
downloadbox64-decec260b2bccc4f3d99eaef0bc68c55bbf2db28.tar.gz
box64-decec260b2bccc4f3d99eaef0bc68c55bbf2db28.zip
[DYNAREC] Make sure a dynablock does not exit a mmap backed by a file address range
Diffstat (limited to 'src/dynarec/dynarec_native.c')
-rw-r--r--src/dynarec/dynarec_native.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dynarec/dynarec_native.c b/src/dynarec/dynarec_native.c
index b6e7a86b..65868435 100644
--- a/src/dynarec/dynarec_native.c
+++ b/src/dynarec/dynarec_native.c
@@ -633,6 +633,9 @@ dynablock_t* FillBlock64(uintptr_t addr, int alternate, int is32bits, int inst_m
     helper.next_cap = MAX_INSTS;
     helper.table64 = static_table64;
     helper.table64cap = sizeof(static_table64)/sizeof(uint64_t);
+    helper.end = addr + SizeFileMapped(addr);
+    if(helper.end == helper.start)  // that means there is no mmap with a file associated to the memory
+        helper.end = (uintptr_t)~0LL;
     // pass 0, addresses, x64 jump addresses, overall size of the block
     uintptr_t end = native_pass0(&helper, addr, alternate, is32bits, inst_max);
     if(helper.abort) {