1
0
mirror of https://github.com/xmrig/xmrig.git synced 2026-01-24 15:20:29 -05:00

RandomX: correct memcpy size for JIT initialization

No buffer overflow, better fix for `_FORTIFY_SOURCE`
This commit is contained in:
SChernykh
2024-04-14 09:13:00 +02:00
parent c7c26d97fe
commit caae7c64f0
5 changed files with 5 additions and 6 deletions

View File

@@ -260,8 +260,7 @@ typedef void(randomx::JitCompilerX86::* InstructionGeneratorX86_2)(const randomx
#define JIT_HANDLE(x, prev) do { \
const InstructionGeneratorX86_2 p = &randomx::JitCompilerX86::h_##x; \
static_assert(sizeof(p) == sizeof(randomx::JitCompilerX86::engine[k]), "Pointer size mismatch"); \
memcpy(randomx::JitCompilerX86::engine + k, &p, sizeof(p)); \
memcpy(randomx::JitCompilerX86::engine + k, &p, sizeof(randomx::JitCompilerX86::engine[k])); \
} while (0)
#elif (XMRIG_ARM == 8)