Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
80a1155c
Commit
80a1155c
authored
May 03, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Split HEAP_IsRealArena to heap_validate and heap_validate_ptr.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e2648318
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
32 deletions
+21
-32
heap.c
dlls/ntdll/heap.c
+21
-32
No files found.
dlls/ntdll/heap.c
View file @
80a1155c
...
...
@@ -181,7 +181,7 @@ typedef struct tagHEAP
static
HEAP
*
processHeap
;
/* main process heap */
static
BOOL
HEAP_IsRealArena
(
HEAP
*
heapPtr
,
LPCVOID
block
,
BOOL
quiet
);
static
BOOL
heap_validate
(
HEAP
*
heap
,
BOOL
quiet
);
/* mark a block of memory as free for debugging purposes */
static
inline
void
mark_block_free
(
void
*
ptr
,
SIZE_T
size
,
DWORD
flags
)
...
...
@@ -480,7 +480,7 @@ static HEAP *HEAP_GetPtr(
if
(
heapPtr
->
flags
&
HEAP_VALIDATE_ALL
)
{
heap_lock
(
heapPtr
,
0
);
valid
=
HEAP_IsRealArena
(
heapPtr
,
NULL
,
NOISY
);
valid
=
heap_validate
(
heapPtr
,
NOISY
);
heap_unlock
(
heapPtr
,
0
);
if
(
!
valid
&&
TRACE_ON
(
heap
))
...
...
@@ -1344,44 +1344,32 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *
}
/***********************************************************************
* HEAP_IsRealArena [Internal]
* Validates a block is a valid arena.
*
* RETURNS
* TRUE: Success
* FALSE: Failure
*/
static
BOOL
HEAP_IsRealArena
(
HEAP
*
heap
,
/* [in] ptr to the heap */
LPCVOID
block
,
/* [in] Optional pointer to memory block to validate */
BOOL
quiet
)
/* [in] Flag - if true, HEAP_ValidateInUseArena
* does not complain */
static
BOOL
heap_validate_ptr
(
HEAP
*
heap
,
const
void
*
ptr
)
{
SUBHEAP
*
subheap
;
const
ARENA_INUSE
*
arena
=
(
const
ARENA_INUSE
*
)
ptr
-
1
;
const
ARENA_LARGE
*
large_arena
;
SUBHEAP
*
subheap
;
if
(
block
)
/* only check this single memory block */
if
(
!
(
subheap
=
HEAP_FindSubHeap
(
heap
,
arena
))
||
((
const
char
*
)
arena
<
(
char
*
)
subheap
->
base
+
subheap
->
headerSize
))
{
const
ARENA_INUSE
*
arena
=
(
const
ARENA_INUSE
*
)
block
-
1
;
if
(
!
(
subheap
=
HEAP_FindSubHeap
(
heap
,
arena
))
||
((
const
char
*
)
arena
<
(
char
*
)
subheap
->
base
+
subheap
->
headerSize
))
if
(
!
(
large_arena
=
find_large_block
(
heap
,
ptr
)))
{
if
(
!
(
large_arena
=
find_large_block
(
heap
,
block
)))
{
if
(
quiet
==
NOISY
)
ERR
(
"Heap %p: block %p is not inside heap
\n
"
,
heap
,
block
);
else
if
(
WARN_ON
(
heap
))
WARN
(
"Heap %p: block %p is not inside heap
\n
"
,
heap
,
block
);
return
FALSE
;
}
return
validate_large_arena
(
heap
,
large_arena
,
quiet
);
if
(
WARN_ON
(
heap
))
WARN
(
"heap %p, ptr %p is not inside heap
\n
"
,
heap
,
ptr
);
return
FALSE
;
}
return
HEAP_ValidateInUseArena
(
subheap
,
arena
,
quiet
);
return
validate_large_arena
(
heap
,
large_arena
,
QUIET
);
}
return
HEAP_ValidateInUseArena
(
subheap
,
arena
,
QUIET
);
}
static
BOOL
heap_validate
(
HEAP
*
heap
,
BOOL
quiet
)
{
const
ARENA_LARGE
*
large_arena
;
SUBHEAP
*
subheap
;
LIST_FOR_EACH_ENTRY
(
subheap
,
&
heap
->
subheap_list
,
SUBHEAP
,
entry
)
{
char
*
ptr
=
(
char
*
)
subheap
->
base
+
subheap
->
headerSize
;
...
...
@@ -2087,7 +2075,8 @@ BOOLEAN WINAPI RtlValidateHeap( HANDLE heap, ULONG flags, const void *ptr )
else
{
heap_lock
(
heapPtr
,
flags
);
ret
=
HEAP_IsRealArena
(
heapPtr
,
ptr
,
QUIET
);
if
(
ptr
)
ret
=
heap_validate_ptr
(
heapPtr
,
ptr
);
else
ret
=
heap_validate
(
heapPtr
,
QUIET
);
heap_unlock
(
heapPtr
,
flags
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment