about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-01-14 19:47:23 +0800
committerGitHub <noreply@github.com>2025-01-14 12:47:23 +0100
commitfa2bd920bd2b80900de2958bed87af5a70796a54 (patch)
treea62bc67989c4e1e140676936ee2af22c373177d0
parent613f2cccf15674f91c9b539fe2ed6f5c4a1164c8 (diff)
downloadbox64-fa2bd920bd2b80900de2958bed87af5a70796a54.tar.gz
box64-fa2bd920bd2b80900de2958bed87af5a70796a54.zip
[RV64_DYNAREC] Fixed offsetof(x64emu_t, scratch) usage overflow ([LA64_DYNAREC] too) (#2262)
-rw-r--r--src/emu/x64emu_private.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/emu/x64emu_private.h b/src/emu/x64emu_private.h
index ff2d6af5..a9d73937 100644
--- a/src/emu/x64emu_private.h
+++ b/src/emu/x64emu_private.h
@@ -110,15 +110,17 @@ typedef struct x64emu_s {
     forkpty_t*  forkpty_info;
     emu_flags_t flags;
     x64test_t   test;       // used for dynarec testing
+    // scratch stack, used for alignment of double and 64bits ints on arm. 200 elements should be enough
+    __int128_t dummy_align; // here to have scratch 128bits aligned
+    uint64_t scratch[N_SCRATCH];
+
+    // Warning, offsetof(x64emu_t, xxx) will be too big for fields below.
     #ifdef HAVE_TRACE
     sse_regs_t  old_xmm[16];
     sse_regs_t  old_ymm[16];
     reg64_t     oldregs[16];
     uintptr_t   prev2_ip;
     #endif
-    // scratch stack, used for alignment of double and 64bits ints on arm. 200 elements should be enough
-    __int128_t  dummy_align;    // here to have scratch 128bits aligned
-    uint64_t    scratch[N_SCRATCH];
     // local stack, do be deleted when emu is freed
     void*       stack2free; // this is the stack to free (can be NULL)
     void*       init_stack; // initial stack (owned or not)