From c7c26d97fe6474416aaf8263d2b08ba00100f010 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Sat, 13 Apr 2024 20:32:16 +0200 Subject: [PATCH] RandomX: check pointer sizes during JIT initialization --- src/crypto/randomx/randomx.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/crypto/randomx/randomx.cpp b/src/crypto/randomx/randomx.cpp index ed520aa84..0485d4ec2 100644 --- a/src/crypto/randomx/randomx.cpp +++ b/src/crypto/randomx/randomx.cpp @@ -260,6 +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)); \ } while (0)