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
3001a2ff
Commit
3001a2ff
authored
May 04, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use block helpers to iterate blocks in heap_validate.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
06681774
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
heap.c
dlls/ntdll/heap.c
+7
-10
No files found.
dlls/ntdll/heap.c
View file @
3001a2ff
...
...
@@ -286,7 +286,7 @@ static inline BOOL check_subheap( const SUBHEAP *subheap )
return
contains
(
base
,
subheap
->
size
,
base
+
subheap
->
headerSize
,
subheap
->
commitSize
-
subheap
->
headerSize
);
}
static
BOOL
heap_validate
(
HEAP
*
heap
);
static
BOOL
heap_validate
(
const
HEAP
*
heap
);
/* mark a block of memory as free for debugging purposes */
static
inline
void
mark_block_free
(
void
*
ptr
,
SIZE_T
size
,
DWORD
flags
)
...
...
@@ -1287,15 +1287,14 @@ static BOOL heap_validate_ptr( const HEAP *heap, const void *ptr, SUBHEAP **subh
return
validate_used_block
(
*
subheap
,
arena
);
}
static
BOOL
heap_validate
(
HEAP
*
heap
)
static
BOOL
heap_validate
(
const
HEAP
*
heap
)
{
const
ARENA_LARGE
*
large_arena
;
const
struct
block
*
block
;
const
SUBHEAP
*
subheap
;
LIST_FOR_EACH_ENTRY
(
subheap
,
&
heap
->
subheap_list
,
SUBHEAP
,
entry
)
{
char
*
ptr
=
(
char
*
)
subheap
->
base
+
subheap
->
headerSize
;
if
(
!
check_subheap
(
subheap
))
{
ERR
(
"heap %p, subheap %p corrupted sizes
\n
"
,
heap
,
subheap
);
...
...
@@ -1303,17 +1302,15 @@ static BOOL heap_validate( HEAP *heap )
return
FALSE
;
}
while
(
ptr
<
(
char
*
)
subheap
->
base
+
subheap
->
size
)
for
(
block
=
first_block
(
subheap
);
block
;
block
=
next_block
(
subheap
,
block
)
)
{
if
(
*
(
DWORD
*
)
ptr
&
ARENA_FLAG_FREE
)
if
(
block_get_flags
(
block
)
&
ARENA_FLAG_FREE
)
{
if
(
!
validate_free_block
(
subheap
,
(
ARENA_INUSE
*
)
ptr
))
return
FALSE
;
ptr
+=
sizeof
(
ARENA_FREE
)
+
(
*
(
DWORD
*
)
ptr
&
ARENA_SIZE_MASK
);
if
(
!
validate_free_block
(
subheap
,
block
))
return
FALSE
;
}
else
{
if
(
!
validate_used_block
(
subheap
,
(
ARENA_INUSE
*
)
ptr
))
return
FALSE
;
ptr
+=
sizeof
(
ARENA_INUSE
)
+
(
*
(
DWORD
*
)
ptr
&
ARENA_SIZE_MASK
);
if
(
!
validate_used_block
(
subheap
,
block
))
return
FALSE
;
}
}
}
...
...
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