mirror of
https://github.com/decaf-emu/decaf-emu.git
synced 2024-05-13 02:04:56 -04:00
ios/kernel: Check block state in IOS_HeapRealloc
This commit is contained in:
parent
d985cc8b2b
commit
a0f9d66703
|
@ -449,6 +449,11 @@ IOS_HeapRealloc(HeapId heapId,
|
|||
}
|
||||
|
||||
auto block = phys_cast<HeapBlock *>(phys_cast<uint8_t *>(ptr) - sizeof(HeapBlock));
|
||||
if (block->state != HeapBlockState::Allocated && block->state != HeapBlockState::InnerBlock) {
|
||||
heap->errorCountExpandInvalidBlock++;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto blockSize = block->size;
|
||||
size = align_up(size, HeapAllocSizeAlign);
|
||||
|
||||
|
|
Loading…
Reference in a new issue