Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1b232833
Commit
1b232833
authored
May 04, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use a fixed block tail size.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
36d32eb8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
heap.c
dlls/ntdll/heap.c
+9
-8
No files found.
dlls/ntdll/heap.c
View file @
1b232833
...
...
@@ -349,14 +349,15 @@ static inline void mark_block_free( void *ptr, SIZE_T size, DWORD flags )
}
/* mark a block of memory as a tail block */
static
inline
void
mark_block_tail
(
void
*
ptr
,
SIZE_T
size
,
DWORD
flags
)
static
inline
void
mark_block_tail
(
struct
block
*
block
,
DWORD
flags
)
{
char
*
tail
=
(
char
*
)
block
+
block_get_size
(
block
)
-
block
->
unused_bytes
;
if
(
flags
&
HEAP_TAIL_CHECKING_ENABLED
)
{
valgrind_make_writable
(
ptr
,
size
);
memset
(
ptr
,
ARENA_TAIL_FILLER
,
size
);
valgrind_make_writable
(
tail
,
ALIGNMENT
);
memset
(
tail
,
ARENA_TAIL_FILLER
,
ALIGNMENT
);
}
valgrind_make_noaccess
(
ptr
,
size
);
valgrind_make_noaccess
(
tail
,
ALIGNMENT
);
}
/* initialize contents of a newly created block of memory */
...
...
@@ -1161,7 +1162,7 @@ static BOOL validate_used_block( const SUBHEAP *subheap, const struct block *blo
else
if
(
!
err
&&
(
flags
&
HEAP_TAIL_CHECKING_ENABLED
))
{
const
unsigned
char
*
tail
=
(
unsigned
char
*
)
block
+
block_get_size
(
block
)
-
block
->
unused_bytes
;
for
(
i
=
0
;
!
err
&&
i
<
block
->
unused_bytes
;
i
++
)
if
(
tail
[
i
]
!=
ARENA_TAIL_FILLER
)
err
=
"invalid block tail"
;
for
(
i
=
0
;
!
err
&&
i
<
ALIGNMENT
;
i
++
)
if
(
tail
[
i
]
!=
ARENA_TAIL_FILLER
)
err
=
"invalid block tail"
;
}
if
(
err
)
...
...
@@ -1328,7 +1329,7 @@ static void heap_set_debug_flags( HANDLE handle )
else
{
if
(
block_get_type
(
block
)
==
ARENA_PENDING_MAGIC
)
mark_block_free
(
block
+
1
,
block_get_size
(
block
)
-
sizeof
(
*
block
),
flags
);
else
mark_block_tail
(
(
char
*
)
block
+
block_get_size
(
block
)
-
block
->
unused_bytes
,
block
->
unused_bytes
,
flags
);
else
mark_block_tail
(
block
,
flags
);
}
}
}
...
...
@@ -1493,7 +1494,7 @@ static NTSTATUS heap_allocate( HEAP *heap, ULONG flags, SIZE_T size, void **ret
block_set_type
(
block
,
ARENA_INUSE_MAGIC
);
shrink_used_block
(
subheap
,
block
,
0
,
old_block_size
,
block_size
,
size
);
initialize_block
(
block
+
1
,
size
,
flags
);
mark_block_tail
(
(
char
*
)(
block
+
1
)
+
size
,
block
->
unused_bytes
,
flags
);
mark_block_tail
(
block
,
flags
);
*
ret
=
block
+
1
;
return
STATUS_SUCCESS
;
...
...
@@ -1614,7 +1615,7 @@ static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size
shrink_used_block
(
subheap
,
block
,
block_get_flags
(
block
),
old_block_size
,
block_size
,
size
);
if
(
size
>
old_size
)
initialize_block
(
(
char
*
)(
block
+
1
)
+
old_size
,
size
-
old_size
,
flags
);
mark_block_tail
(
(
char
*
)(
block
+
1
)
+
size
,
block
->
unused_bytes
,
flags
);
mark_block_tail
(
block
,
flags
);
/* Return the new arena */
...
...
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