mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
CachedInterpreterEmitter: Fix std::memcpy
UB
I wasn't aware that even with a size of zero, it's still not safe to pass a nullptr to `std::memcpy`. When `CachedInterpreterEmitter::PoisonCallback` is written, UB is happening.
This commit is contained in:
parent
7d08377341
commit
5a95c5dd14
@ -19,6 +19,8 @@ void CachedInterpreterEmitter::Write(AnyCallback callback, const void* operands,
|
|||||||
}
|
}
|
||||||
std::memcpy(m_code, &callback, sizeof(callback));
|
std::memcpy(m_code, &callback, sizeof(callback));
|
||||||
m_code += sizeof(callback);
|
m_code += sizeof(callback);
|
||||||
|
if (size == 0)
|
||||||
|
return;
|
||||||
std::memcpy(m_code, operands, size);
|
std::memcpy(m_code, operands, size);
|
||||||
m_code += size;
|
m_code += size;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user