From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/kernel32/tests/heap.c | 7 +++---- dlls/ntdll/heap.c | 9 +-------- 2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index 8ef0bfc3668..795d758a4f2 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -2242,7 +2242,6 @@ static void test_block_layout( HANDLE heap, DWORD global_flags, DWORD heap_flags ok( diff > expect_size, "got diff %#Ix\n", diff );
tail = ptr0[alloc_size] | ptr1[alloc_size] | ptr2[alloc_size]; - todo_wine_if( heap_flags & HEAP_TAIL_CHECKING_ENABLED ) ok( !tail, "got tail\n" );
ret = HeapFree( heap, 0, ptr2 ); @@ -2492,9 +2491,9 @@ static void test_heap_checks( DWORD flags ) if (flags & HEAP_TAIL_CHECKING_ENABLED) { /* Windows doesn't do tail checking on large blocks */ - ok( p[large_size] == 0xab || broken(p[large_size] == 0), "wrong data %x\n", p[large_size] ); - ok( p[large_size+1] == 0xab || broken(p[large_size+1] == 0), "wrong data %x\n", p[large_size+1] ); - ok( p[large_size+2] == 0xab || broken(p[large_size+2] == 0), "wrong data %x\n", p[large_size+2] ); + ok( p[large_size] == 0, "wrong data %x\n", p[large_size] ); + ok( p[large_size+1] == 0, "wrong data %x\n", p[large_size+1] ); + ok( p[large_size+2] == 0, "wrong data %x\n", p[large_size+2] ); if (p[large_size] == 0xab) { p[large_size] = 0xcc; diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 2b390bfed7d..f8c0eba89e0 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -785,7 +785,7 @@ static inline void shrink_used_block( SUBHEAP *subheap, struct block *block, UIN static void *allocate_large_block( HEAP *heap, DWORD flags, SIZE_T size ) { ARENA_LARGE *arena; - SIZE_T block_size = sizeof(*arena) + ROUND_SIZE(size) + HEAP_TAIL_EXTRA_SIZE(flags); + SIZE_T block_size = sizeof(*arena) + ROUND_SIZE(size); LPVOID address = NULL;
if (!(flags & HEAP_GROWABLE)) return NULL; @@ -801,7 +801,6 @@ static void *allocate_large_block( HEAP *heap, DWORD flags, SIZE_T size ) arena->block_size = block_size; arena->size = ARENA_LARGE_SIZE; arena->magic = ARENA_LARGE_MAGIC; - mark_block_tail( (char *)(arena + 1) + size, block_size - sizeof(*arena) - size, flags ); list_add_tail( &heap->large_list, &arena->entry ); notify_alloc( arena + 1, size, flags & HEAP_ZERO_MEMORY ); return arena + 1; @@ -883,12 +882,6 @@ static BOOL validate_large_arena( const HEAP *heap, const ARENA_LARGE *arena ) err = "invalid block header"; else if (!contains( arena, arena->block_size, arena + 1, arena->data_size )) err = "invalid block size"; - else if (heap->flags & HEAP_TAIL_CHECKING_ENABLED) - { - SIZE_T i, unused = arena->block_size - sizeof(*arena) - arena->data_size; - const unsigned char *data = (const unsigned char *)(arena + 1) + arena->data_size; - for (i = 0; i < unused && !err; i++) if (data[i] != ARENA_TAIL_FILLER) err = "invalid block tail"; - }
if (err) {