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
c2bff6b6
Commit
c2bff6b6
authored
Dec 01, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Dec 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Keep subheap parent heap pointer and check for mismatches.
parent
4502c1da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
heap.c
dlls/ntdll/heap.c
+4
-1
No files found.
dlls/ntdll/heap.c
View file @
c2bff6b6
...
@@ -949,6 +949,7 @@ static SUBHEAP *create_subheap( struct heap *heap, DWORD flags, SIZE_T total_siz
...
@@ -949,6 +949,7 @@ static SUBHEAP *create_subheap( struct heap *heap, DWORD flags, SIZE_T total_siz
if
(
!
(
subheap
=
allocate_region
(
heap
,
flags
,
&
total_size
,
&
commit_size
)))
return
NULL
;
if
(
!
(
subheap
=
allocate_region
(
heap
,
flags
,
&
total_size
,
&
commit_size
)))
return
NULL
;
subheap
->
user_value
=
heap
;
subheap_set_bounds
(
subheap
,
(
char
*
)
subheap
+
commit_size
,
(
char
*
)
subheap
+
total_size
);
subheap_set_bounds
(
subheap
,
(
char
*
)
subheap
+
commit_size
,
(
char
*
)
subheap
+
total_size
);
block_size
=
(
SIZE_T
)
ROUND_ADDR
(
subheap_size
(
subheap
)
-
subheap_overhead
(
subheap
),
BLOCK_ALIGN
-
1
);
block_size
=
(
SIZE_T
)
ROUND_ADDR
(
subheap_size
(
subheap
)
-
subheap_overhead
(
subheap
),
BLOCK_ALIGN
-
1
);
block_init_free
(
first_block
(
subheap
),
flags
,
subheap
,
block_size
);
block_init_free
(
first_block
(
subheap
),
flags
,
subheap
,
block_size
);
...
@@ -1195,7 +1196,8 @@ static inline struct block *unsafe_block_from_ptr( struct heap *heap, ULONG flag
...
@@ -1195,7 +1196,8 @@ static inline struct block *unsafe_block_from_ptr( struct heap *heap, ULONG flag
else
if
(
block_get_type
(
block
)
==
BLOCK_TYPE_USED
)
else
if
(
block_get_type
(
block
)
==
BLOCK_TYPE_USED
)
{
{
const
char
*
base
=
subheap_base
(
subheap
),
*
commit_end
=
subheap_commit_end
(
subheap
);
const
char
*
base
=
subheap_base
(
subheap
),
*
commit_end
=
subheap_commit_end
(
subheap
);
if
(
!
contains
(
base
,
commit_end
-
base
,
block
,
block_get_size
(
block
)
))
err
=
"invalid block size"
;
if
(
subheap
->
user_value
!=
heap
)
err
=
"mismatching heap"
;
else
if
(
!
contains
(
base
,
commit_end
-
base
,
block
,
block_get_size
(
block
)
))
err
=
"invalid block size"
;
}
}
else
if
(
block_get_type
(
block
)
==
BLOCK_TYPE_LARGE
)
else
if
(
block_get_type
(
block
)
==
BLOCK_TYPE_LARGE
)
{
{
...
@@ -1374,6 +1376,7 @@ HANDLE WINAPI RtlCreateHeap( ULONG flags, void *addr, SIZE_T total_size, SIZE_T
...
@@ -1374,6 +1376,7 @@ HANDLE WINAPI RtlCreateHeap( ULONG flags, void *addr, SIZE_T total_size, SIZE_T
}
}
subheap
=
&
heap
->
subheap
;
subheap
=
&
heap
->
subheap
;
subheap
->
user_value
=
heap
;
subheap_set_bounds
(
subheap
,
(
char
*
)
heap
+
commit_size
,
(
char
*
)
heap
+
total_size
);
subheap_set_bounds
(
subheap
,
(
char
*
)
heap
+
commit_size
,
(
char
*
)
heap
+
total_size
);
block_size
=
(
SIZE_T
)
ROUND_ADDR
(
subheap_size
(
subheap
)
-
subheap_overhead
(
subheap
),
BLOCK_ALIGN
-
1
);
block_size
=
(
SIZE_T
)
ROUND_ADDR
(
subheap_size
(
subheap
)
-
subheap_overhead
(
subheap
),
BLOCK_ALIGN
-
1
);
block_init_free
(
first_block
(
subheap
),
flags
,
subheap
,
block_size
);
block_init_free
(
first_block
(
subheap
),
flags
,
subheap
,
block_size
);
...
...
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