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
6ab02001
Commit
6ab02001
authored
May 16, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Simplify validate_large_arena.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
585f5223
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
54 deletions
+19
-54
heap.c
dlls/ntdll/heap.c
+19
-54
No files found.
dlls/ntdll/heap.c
View file @
6ab02001
...
@@ -926,66 +926,31 @@ static ARENA_LARGE *find_large_block( const HEAP *heap, const void *ptr )
...
@@ -926,66 +926,31 @@ static ARENA_LARGE *find_large_block( const HEAP *heap, const void *ptr )
return
NULL
;
return
NULL
;
}
}
static
BOOL
validate_large_arena
(
const
HEAP
*
heap
,
const
ARENA_LARGE
*
arena
)
/***********************************************************************
* validate_large_arena
*/
static
BOOL
validate_large_arena
(
const
HEAP
*
heap
,
const
ARENA_LARGE
*
arena
,
BOOL
quiet
)
{
{
DWORD
flags
=
heap
->
flags
;
const
char
*
err
=
NULL
;
if
((
ULONG_PTR
)
arena
%
page_size
)
if
((
ULONG_PTR
)
arena
&
COMMIT_MASK
)
{
err
=
"invalid block alignment"
;
if
(
quiet
==
NOISY
)
else
if
(
arena
->
size
!=
ARENA_LARGE_SIZE
||
arena
->
magic
!=
ARENA_LARGE_MAGIC
)
{
err
=
"invalid block header"
;
ERR
(
"Heap %p: invalid large arena pointer %p
\n
"
,
heap
,
arena
);
else
if
(
!
contains
(
arena
,
arena
->
block_size
,
arena
+
1
,
arena
->
data_size
))
if
(
TRACE_ON
(
heap
))
heap_dump
(
heap
);
err
=
"invalid block size"
;
}
else
if
(
heap
->
flags
&
HEAP_TAIL_CHECKING_ENABLED
)
else
if
(
WARN_ON
(
heap
))
{
WARN
(
"Heap %p: unaligned arena pointer %p
\n
"
,
heap
,
arena
);
if
(
TRACE_ON
(
heap
))
heap_dump
(
heap
);
}
return
FALSE
;
}
if
(
arena
->
size
!=
ARENA_LARGE_SIZE
||
arena
->
magic
!=
ARENA_LARGE_MAGIC
)
{
if
(
quiet
==
NOISY
)
{
ERR
(
"Heap %p: invalid large arena %p values %x/%x
\n
"
,
heap
,
arena
,
arena
->
size
,
arena
->
magic
);
if
(
TRACE_ON
(
heap
))
heap_dump
(
heap
);
}
else
if
(
WARN_ON
(
heap
))
{
WARN
(
"Heap %p: invalid large arena %p values %x/%x
\n
"
,
heap
,
arena
,
arena
->
size
,
arena
->
magic
);
if
(
TRACE_ON
(
heap
))
heap_dump
(
heap
);
}
return
FALSE
;
}
if
(
arena
->
data_size
>
arena
->
block_size
-
sizeof
(
*
arena
))
{
ERR
(
"Heap %p: invalid large arena %p size %lx/%lx
\n
"
,
heap
,
arena
,
arena
->
data_size
,
arena
->
block_size
);
return
FALSE
;
}
if
(
flags
&
HEAP_TAIL_CHECKING_ENABLED
)
{
{
SIZE_T
i
,
unused
=
arena
->
block_size
-
sizeof
(
*
arena
)
-
arena
->
data_size
;
SIZE_T
i
,
unused
=
arena
->
block_size
-
sizeof
(
*
arena
)
-
arena
->
data_size
;
const
unsigned
char
*
data
=
(
const
unsigned
char
*
)(
arena
+
1
)
+
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"
;
}
for
(
i
=
0
;
i
<
unused
;
i
++
)
if
(
err
)
{
{
if
(
data
[
i
]
==
ARENA_TAIL_FILLER
)
continue
;
ERR
(
"heap %p, block %p: %s
\n
"
,
heap
,
arena
,
err
);
ERR
(
"Heap %p: block %p tail overwritten at %p (byte %lu/%lu == 0x%02x)
\n
"
,
if
(
TRACE_ON
(
heap
))
heap_dump
(
heap
);
heap
,
arena
+
1
,
data
+
i
,
i
,
unused
,
data
[
i
]
);
return
FALSE
;
}
}
}
return
TRUE
;
}
return
!
err
;
}
/***********************************************************************
/***********************************************************************
* HEAP_CreateSubHeap
* HEAP_CreateSubHeap
...
@@ -1451,7 +1416,7 @@ static BOOL heap_validate_ptr( const HEAP *heap, const void *ptr, SUBHEAP **subh
...
@@ -1451,7 +1416,7 @@ static BOOL heap_validate_ptr( const HEAP *heap, const void *ptr, SUBHEAP **subh
return
FALSE
;
return
FALSE
;
}
}
return
validate_large_arena
(
heap
,
large_arena
,
QUIET
);
return
validate_large_arena
(
heap
,
large_arena
);
}
}
return
HEAP_ValidateInUseArena
(
*
subheap
,
arena
,
QUIET
);
return
HEAP_ValidateInUseArena
(
*
subheap
,
arena
,
QUIET
);
...
@@ -1489,7 +1454,7 @@ static BOOL heap_validate( HEAP *heap, BOOL quiet )
...
@@ -1489,7 +1454,7 @@ static BOOL heap_validate( HEAP *heap, BOOL quiet )
}
}
LIST_FOR_EACH_ENTRY
(
large_arena
,
&
heap
->
large_list
,
ARENA_LARGE
,
entry
)
LIST_FOR_EACH_ENTRY
(
large_arena
,
&
heap
->
large_list
,
ARENA_LARGE
,
entry
)
if
(
!
validate_large_arena
(
heap
,
large_arena
,
quiet
))
return
FALSE
;
if
(
!
validate_large_arena
(
heap
,
large_arena
))
return
FALSE
;
return
TRUE
;
return
TRUE
;
}
}
...
...
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