mirror of
https://github.com/wownero/RandomX.git
synced 2026-10-18 16:01:40 +02:00
fix potential use-after-free when reallocating cache
This commit is contained in:
+1
-1
@@ -329,7 +329,7 @@ extern "C" {
|
||||
void randomx_vm_set_cache(randomx_vm *machine, randomx_cache* cache) {
|
||||
assert(machine != nullptr);
|
||||
assert(cache != nullptr && cache->isInitialized());
|
||||
if (machine->cacheKey != cache->cacheKey) {
|
||||
if (machine->cacheKey != cache->cacheKey || machine->getMemory() != cache->memory) {
|
||||
machine->setCache(cache);
|
||||
machine->cacheKey = cache->cacheKey;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user