From f6c50b5393ce1ba8596336dc867ec8eefcd9d7a2 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Wed, 20 Mar 2024 21:24:02 +0100 Subject: [PATCH] Fix RandomX crash when compiled with fortify_source --- src/crypto/randomx/jit_compiler_a64.cpp | 2 +- src/crypto/randomx/jit_compiler_a64.hpp | 2 +- src/crypto/randomx/jit_compiler_x86.cpp | 2 +- src/crypto/randomx/jit_compiler_x86.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto/randomx/jit_compiler_a64.cpp b/src/crypto/randomx/jit_compiler_a64.cpp index 05dac9f78..4bfe157ea 100644 --- a/src/crypto/randomx/jit_compiler_a64.cpp +++ b/src/crypto/randomx/jit_compiler_a64.cpp @@ -1078,6 +1078,6 @@ void JitCompilerA64::h_NOP(Instruction& instr, uint32_t& codePos) { } -InstructionGeneratorA64 JitCompilerA64::engine[256] = {}; +InstructionGeneratorA64 JitCompilerA64::engine[257] = {}; } diff --git a/src/crypto/randomx/jit_compiler_a64.hpp b/src/crypto/randomx/jit_compiler_a64.hpp index 32ff5166e..15c90af80 100644 --- a/src/crypto/randomx/jit_compiler_a64.hpp +++ b/src/crypto/randomx/jit_compiler_a64.hpp @@ -74,7 +74,7 @@ namespace randomx { void enableWriting() const; void enableExecution() const; - static InstructionGeneratorA64 engine[256]; + static InstructionGeneratorA64 engine[257]; private: const bool hugePages; diff --git a/src/crypto/randomx/jit_compiler_x86.cpp b/src/crypto/randomx/jit_compiler_x86.cpp index 7f9fb3b68..78ab8b58f 100644 --- a/src/crypto/randomx/jit_compiler_x86.cpp +++ b/src/crypto/randomx/jit_compiler_x86.cpp @@ -1443,6 +1443,6 @@ namespace randomx { emitByte(0x90, code, codePos); } - alignas(64) InstructionGeneratorX86 JitCompilerX86::engine[256] = {}; + alignas(64) InstructionGeneratorX86 JitCompilerX86::engine[257] = {}; } diff --git a/src/crypto/randomx/jit_compiler_x86.hpp b/src/crypto/randomx/jit_compiler_x86.hpp index 152619226..11106b2f3 100644 --- a/src/crypto/randomx/jit_compiler_x86.hpp +++ b/src/crypto/randomx/jit_compiler_x86.hpp @@ -81,7 +81,7 @@ namespace randomx { void enableWriting() const; void enableExecution() const; - alignas(64) static InstructionGeneratorX86 engine[256]; + alignas(64) static InstructionGeneratorX86 engine[257]; private: int registerUsage[RegistersCount] = {};