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
fdd66643
Commit
fdd66643
authored
Mar 29, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure the import directory is not in shared memory.
parent
34372dcb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
virtual.c
memory/virtual.c
+17
-0
No files found.
memory/virtual.c
View file @
fdd66643
...
...
@@ -502,6 +502,7 @@ static LPVOID map_image( HANDLE hmapping, int fd, char *base, DWORD total_size,
IMAGE_DOS_HEADER
*
dos
;
IMAGE_NT_HEADERS
*
nt
;
IMAGE_SECTION_HEADER
*
sec
;
IMAGE_DATA_DIRECTORY
*
imports
;
int
i
,
pos
;
DWORD
err
=
GetLastError
();
FILE_VIEW
*
view
;
...
...
@@ -536,6 +537,9 @@ static LPVOID map_image( HANDLE hmapping, int fd, char *base, DWORD total_size,
sec
=
(
IMAGE_SECTION_HEADER
*
)((
char
*
)
&
nt
->
OptionalHeader
+
nt
->
FileHeader
.
SizeOfOptionalHeader
);
if
((
char
*
)(
sec
+
nt
->
FileHeader
.
NumberOfSections
)
>
ptr
+
header_size
)
goto
error
;
imports
=
nt
->
OptionalHeader
.
DataDirectory
+
IMAGE_DIRECTORY_ENTRY_IMPORT
;
if
(
!
imports
->
Size
||
!
imports
->
VirtualAddress
)
imports
=
NULL
;
/* check the architecture */
if
(
nt
->
FileHeader
.
Machine
!=
IMAGE_FILE_MACHINE_I386
)
...
...
@@ -595,6 +599,19 @@ static LPVOID map_image( HANDLE hmapping, int fd, char *base, DWORD total_size,
ERR_
(
module
)(
"Could not map shared section %.8s
\n
"
,
sec
->
Name
);
goto
error
;
}
/* check if the import directory falls inside this section */
if
(
imports
&&
imports
->
VirtualAddress
>=
sec
->
VirtualAddress
&&
imports
->
VirtualAddress
<
sec
->
VirtualAddress
+
size
)
{
DWORD
base
=
imports
->
VirtualAddress
&
~
page_mask
;
DWORD
end
=
imports
->
VirtualAddress
+
ROUND_SIZE
(
imports
->
VirtualAddress
,
imports
->
Size
);
if
(
end
>
sec
->
VirtualAddress
+
size
)
end
=
sec
->
VirtualAddress
+
size
;
if
(
end
>
base
)
VIRTUAL_mmap
(
shared_fd
,
ptr
+
base
,
end
-
base
,
pos
,
0
,
PROT_READ
|
PROT_WRITE
|
PROT_EXEC
,
MAP_PRIVATE
|
MAP_FIXED
,
NULL
);
}
pos
+=
size
;
continue
;
}
...
...
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