[PATCH 0/1] MR3030: ntdll: Raise exception when handle is NULL in RtlAllocateHeap.
Growtopia crashes if we don't raise an exception with a NULL handle. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3030
From: Etaash Mathamsetty <45927311+Etaash-mathamsetty(a)users.noreply.github.com> --- dlls/ntdll/heap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 921a51cf8b1..f65597e159e 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -2052,6 +2052,13 @@ void *WINAPI DECLSPEC_HOTPATCH RtlAllocateHeap( HANDLE handle, ULONG flags, SIZE ULONG heap_flags; NTSTATUS status; + /* Some applications (e.g Growtopia) rely on this behavior */ + if (!handle) + { + RtlRaiseStatus(STATUS_ACCESS_VIOLATION); + return NULL; + } + if (!(heap = unsafe_heap_from_handle( handle, flags, &heap_flags ))) status = STATUS_INVALID_HANDLE; else if ((block_size = heap_get_block_size( heap, heap_flags, size )) == ~0U) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3030
Couldn't you simply let it crash naturally by accessing null pointers? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3030#note_35275
On Fri Jun 9 17:24:41 2023 +0000, Nikolay Sivov wrote:
Couldn't you simply let it crash naturally by accessing null pointers? let me try that
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3030#note_35276
participants (3)
-
Etaash Mathamsetty -
Etaash Mathamsetty (@etaash.mathamsetty) -
Nikolay Sivov (@nsivov)