Merge pull request #13047 from mitaclaw/cached-interpreter-memcpy-ub

CachedInterpreterEmitter: Fix `std::memcpy` UB
This commit is contained in:
Admiral H. Curtiss 2024-09-02 19:47:11 +02:00 committed by GitHub
commit 95fac2a4e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -19,6 +19,8 @@ void CachedInterpreterEmitter::Write(AnyCallback callback, const void* operands,
}
std::memcpy(m_code, &callback, sizeof(callback));
m_code += sizeof(callback);
if (size == 0)
return;
std::memcpy(m_code, operands, size);
m_code += size;
}