mirror of
https://git.wownero.com/wownero/RandomWOW.git
synced 2024-12-21 23:38:54 +00:00
fix potential use-after-free when reallocating cache
This commit is contained in:
parent
7741eb1e97
commit
32ab5dea54
@ -329,7 +329,7 @@ extern "C" {
|
|||||||
void randomx_vm_set_cache(randomx_vm *machine, randomx_cache* cache) {
|
void randomx_vm_set_cache(randomx_vm *machine, randomx_cache* cache) {
|
||||||
assert(machine != nullptr);
|
assert(machine != nullptr);
|
||||||
assert(cache != nullptr && cache->isInitialized());
|
assert(cache != nullptr && cache->isInitialized());
|
||||||
if (machine->cacheKey != cache->cacheKey) {
|
if (machine->cacheKey != cache->cacheKey || machine->getMemory() != cache->memory) {
|
||||||
machine->setCache(cache);
|
machine->setCache(cache);
|
||||||
machine->cacheKey = cache->cacheKey;
|
machine->cacheKey = cache->cacheKey;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,9 @@ public:
|
|||||||
{
|
{
|
||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
const uint8_t* getMemory() const {
|
||||||
|
return mem.memory;
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
void initialize();
|
void initialize();
|
||||||
alignas(64) randomx::Program program;
|
alignas(64) randomx::Program program;
|
||||||
|
Loading…
Reference in New Issue
Block a user