Handling null ptr in NtFreeVirtualMemory.
This commit is contained in:
parent
21b0d25131
commit
748bfe509f
|
@ -636,7 +636,7 @@ XEEMITTER(mtspr, 0x7C0003A6, XFX)(X64Emitter& e, X86Compiler& c, InstrDat
|
||||||
// else
|
// else
|
||||||
// SPR(n) <- (RS)[32:63]
|
// SPR(n) <- (RS)[32:63]
|
||||||
|
|
||||||
GpVar& v = e.gpr_value(i.XFX.RT);
|
GpVar v = e.gpr_value(i.XFX.RT);
|
||||||
|
|
||||||
const uint32_t n = ((i.XFX.spr & 0x1F) << 5) | ((i.XFX.spr >> 5) & 0x1F);
|
const uint32_t n = ((i.XFX.spr & 0x1F) << 5) | ((i.XFX.spr >> 5) & 0x1F);
|
||||||
switch (n) {
|
switch (n) {
|
||||||
|
|
|
@ -121,6 +121,11 @@ SHIM_CALL NtFreeVirtualMemory_shim(
|
||||||
region_size_ptr, region_size_value,
|
region_size_ptr, region_size_value,
|
||||||
free_type, unknown);
|
free_type, unknown);
|
||||||
|
|
||||||
|
if (!base_addr_value) {
|
||||||
|
SHIM_SET_RETURN(X_STATUS_MEMORY_NOT_ALLOCATED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Free.
|
// Free.
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
uint32_t freed_size = xe_memory_heap_free(state->memory(), base_addr_value,
|
uint32_t freed_size = xe_memory_heap_free(state->memory(), base_addr_value,
|
||||||
|
|
|
@ -41,6 +41,7 @@ typedef uint32_t X_STATUS;
|
||||||
#define X_STATUS_BUFFER_TOO_SMALL ((uint32_t)0xC0000023L)
|
#define X_STATUS_BUFFER_TOO_SMALL ((uint32_t)0xC0000023L)
|
||||||
#define X_STATUS_OBJECT_TYPE_MISMATCH ((uint32_t)0xC0000024L)
|
#define X_STATUS_OBJECT_TYPE_MISMATCH ((uint32_t)0xC0000024L)
|
||||||
#define X_STATUS_INVALID_PAGE_PROTECTION ((uint32_t)0xC0000045L)
|
#define X_STATUS_INVALID_PAGE_PROTECTION ((uint32_t)0xC0000045L)
|
||||||
|
#define X_STATUS_MEMORY_NOT_ALLOCATED ((uint32_t)0xC00000A0L)
|
||||||
|
|
||||||
|
|
||||||
// MEM_*, used by NtAllocateVirtualMemory
|
// MEM_*, used by NtAllocateVirtualMemory
|
||||||
|
|
Loading…
Reference in New Issue