mirror of
https://git.wownero.com/wownero/RandomWOW.git
synced 2025-01-03 05:38:54 +00:00
Merge pull request #282 from SChernykh/fix-ub
Fixed UB in ARM64 JIT compiler
This commit is contained in:
commit
5fc512e71c
@ -709,7 +709,8 @@ void JitCompilerA64::h_IMUL_RCP(Instruction& instr, uint32_t& codePos)
|
||||
const uint32_t literal_id = (ImulRcpLiteralsEnd - literalPos) / sizeof(uint64_t);
|
||||
|
||||
literalPos -= sizeof(uint64_t);
|
||||
*(uint64_t*)(code + literalPos) = (q << shift) + ((r << shift) / divisor);
|
||||
const uint64_t randomx_reciprocal = (q << shift) + ((r << shift) / divisor);
|
||||
memcpy(code + literalPos, &randomx_reciprocal, sizeof(randomx_reciprocal));
|
||||
|
||||
if (literal_id < 12)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ namespace randomx {
|
||||
|
||||
static void emit64(uint64_t val, uint8_t* code, uint32_t& codePos)
|
||||
{
|
||||
*(uint64_t*)(code + codePos) = val;
|
||||
memcpy(code + codePos, &val, sizeof(val));
|
||||
codePos += sizeof(val);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user