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
96eebec9
Commit
96eebec9
authored
Jan 25, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Round header size to page boundary before checking it in PE header conversion.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
08ba4461
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
loader.c
dlls/ntdll/loader.c
+7
-2
No files found.
dlls/ntdll/loader.c
View file @
96eebec9
...
...
@@ -1935,16 +1935,21 @@ static BOOL convert_to_pe64( HMODULE module, const pe_image_info_t *info )
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
module
);
SIZE_T
hdr_size
=
min
(
sizeof
(
hdr32
),
nt
->
FileHeader
.
SizeOfOptionalHeader
);
IMAGE_SECTION_HEADER
*
sec
=
(
IMAGE_SECTION_HEADER
*
)((
char
*
)
&
nt
->
OptionalHeader
+
hdr_size
);
SIZE_T
size
=
(
char
*
)(
nt
+
1
)
+
nt
->
FileHeader
.
NumberOfSections
*
sizeof
(
*
sec
)
-
(
char
*
)
modul
e
;
SIZE_T
size
=
info
->
header_siz
e
;
void
*
addr
=
module
;
ULONG
i
,
old_prot
;
TRACE
(
"%p
\n
"
,
module
);
if
(
size
>
info
->
header_size
)
return
FALSE
;
if
(
NtProtectVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
&
size
,
PAGE_READWRITE
,
&
old_prot
))
return
FALSE
;
if
((
char
*
)
module
+
size
<
(
char
*
)(
nt
+
1
)
+
nt
->
FileHeader
.
NumberOfSections
*
sizeof
(
*
sec
))
{
NtProtectVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
&
size
,
old_prot
,
&
old_prot
);
return
FALSE
;
}
memcpy
(
&
hdr32
,
&
nt
->
OptionalHeader
,
hdr_size
);
memcpy
(
&
hdr64
,
&
hdr32
,
offsetof
(
IMAGE_OPTIONAL_HEADER64
,
SizeOfStackReserve
));
hdr64
.
Magic
=
IMAGE_NT_OPTIONAL_HDR64_MAGIC
;
...
...
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