Commit 06ea6e6e authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed a few pointer truncation bugs for 64-bit platforms.

parent cdf92942
......@@ -244,7 +244,7 @@ static void HEAP_Dump( HEAP *heap )
{
ARENA_INUSE *pArena = (ARENA_INUSE *)ptr;
DPRINTF( "%p Used %08lx back=%08lx\n",
pArena, pArena->size & ARENA_SIZE_MASK, *((DWORD *)pArena - 1) );
pArena, pArena->size & ARENA_SIZE_MASK, *((UINT_PTR *)pArena - 1) );
ptr += sizeof(*pArena) + (pArena->size & ARENA_SIZE_MASK);
arenaSize += sizeof(ARENA_INUSE);
usedSize += pArena->size & ARENA_SIZE_MASK;
......@@ -476,7 +476,7 @@ static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, SIZE_T size )
DWORD *pNext = (DWORD *)((char *)ptr + size);
*pNext |= ARENA_FLAG_PREV_FREE;
mark_block_initialized( pNext - 1, sizeof( ARENA_FREE * ) );
*(ARENA_FREE **)(pNext - 1) = pFree;
*((ARENA_FREE **)pNext - 1) = pFree;
}
/* Last, insert the new block into the free list */
......@@ -851,7 +851,7 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
{
ERR("Heap %p: arena %p has wrong back ptr %08lx\n",
subheap->heap, pArena,
*((DWORD *)((char *)(pArena+1) + (pArena->size & ARENA_SIZE_MASK)) - 1));
*((UINT_PTR *)((char *)(pArena+1) + (pArena->size & ARENA_SIZE_MASK)) - 1));
return FALSE;
}
}
......
......@@ -120,15 +120,15 @@ static RTL_CRITICAL_SECTION csVirtual = { &critsect_debug, -1, 0, 0, 0, 0 };
# define USER_SPACE_LIMIT ((void *)0x80000000) /* top of the user address space */
#else
static UINT page_shift;
static UINT page_mask;
static UINT page_size;
static UINT_PTR page_mask;
# define ADDRESS_SPACE_LIMIT 0 /* no limit needed on other platforms */
# define USER_SPACE_LIMIT 0 /* no limit needed on other platforms */
#endif /* __i386__ */
#define granularity_mask 0xffff /* Allocation granularity (usually 64k) */
static const UINT_PTR granularity_mask = 0xffff; /* Allocation granularity (usually 64k) */
#define ROUND_ADDR(addr,mask) \
((void *)((UINT_PTR)(addr) & ~(mask)))
((void *)((UINT_PTR)(addr) & ~(UINT_PTR)(mask)))
#define ROUND_SIZE(addr,size) \
(((UINT)(size) + ((UINT_PTR)(addr) & page_mask) + page_mask) & ~page_mask)
......@@ -1125,13 +1125,14 @@ NTSTATUS VIRTUAL_alloc_teb( void **ret, size_t size, BOOL first )
void *ptr;
NTSTATUS status;
struct file_view *view;
size_t align_size = page_size;
size_t align_size;
BYTE vprot = VPROT_READ | VPROT_WRITE | VPROT_COMMITTED;
if (first) virtual_init();
*ret = NULL;
size = ROUND_SIZE( 0, size );
align_size = page_size;
while (align_size < size) align_size *= 2;
for (;;)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment