mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-22 19:49:36 +00:00
RandomX: correct memcpy size for JIT initialization
No buffer overflow, better fix for `_FORTIFY_SOURCE`
This commit is contained in:
parent
c7c26d97fe
commit
caae7c64f0
5 changed files with 5 additions and 6 deletions
|
@ -1078,6 +1078,6 @@ void JitCompilerA64::h_NOP(Instruction& instr, uint32_t& codePos)
|
|||
{
|
||||
}
|
||||
|
||||
InstructionGeneratorA64 JitCompilerA64::engine[257] = {};
|
||||
InstructionGeneratorA64 JitCompilerA64::engine[256] = {};
|
||||
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace randomx {
|
|||
void enableWriting() const;
|
||||
void enableExecution() const;
|
||||
|
||||
static InstructionGeneratorA64 engine[257];
|
||||
static InstructionGeneratorA64 engine[256];
|
||||
|
||||
private:
|
||||
const bool hugePages;
|
||||
|
|
|
@ -1443,6 +1443,6 @@ namespace randomx {
|
|||
emitByte(0x90, code, codePos);
|
||||
}
|
||||
|
||||
alignas(64) InstructionGeneratorX86 JitCompilerX86::engine[257] = {};
|
||||
alignas(64) InstructionGeneratorX86 JitCompilerX86::engine[256] = {};
|
||||
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace randomx {
|
|||
void enableWriting() const;
|
||||
void enableExecution() const;
|
||||
|
||||
alignas(64) static InstructionGeneratorX86 engine[257];
|
||||
alignas(64) static InstructionGeneratorX86 engine[256];
|
||||
|
||||
private:
|
||||
int registerUsage[RegistersCount] = {};
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue