From: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/ntdll/heap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 9f786dab6f0..70926109547 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -1138,6 +1138,12 @@ static BOOL heap_validate_ptr( const struct heap *heap, const void *ptr ) return validate_large_block( heap, block ); } + if (subheap->user_value != heap) + { + ERR("subheap %p: owner heap mismatch (expected %p, got %p)\n", subheap, heap, subheap->user_value); + return FALSE; + } + if (!validate_used_block( heap, subheap, block )) return FALSE; /* validate_used_block() has checked the alignment; the block is now safe(r) to dereference. @@ -1167,6 +1173,12 @@ static BOOL heap_validate( const struct heap *heap ) return FALSE; } + if (subheap->user_value != heap) + { + ERR("subheap %p: owner heap mismatch (expected %p, got %p)\n", subheap, heap, subheap->user_value); + return FALSE; + } + for (block = first_block( subheap ); block; block = next_block( subheap, block )) { if (block_get_flags( block ) & BLOCK_FLAG_FREE) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1894