'block->base_offset * REGION_ALIGN' overflows once WORD base_offset value reaches 0x8000, so block_get_subheap() returns wrong address.
From: Paul Gofman pgofman@codeweavers.com
--- dlls/ntdll/heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 7547ac50f61..5c882def50e 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -357,7 +357,7 @@ static inline void block_set_type( struct block *block, UINT type ) static inline SUBHEAP *block_get_subheap( const struct heap *heap, const struct block *block ) { char *offset = ROUND_ADDR( block, REGION_ALIGN - 1 ); - void *base = offset - block->base_offset * REGION_ALIGN; + void *base = offset - (SIZE_T)block->base_offset * REGION_ALIGN; if (base != (void *)heap) return base; else return (SUBHEAP *)&heap->subheap; }
This merge request was approved by Rémi Bernon.