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
1a3777e2
Commit
1a3777e2
authored
Nov 04, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Reject VirtualAlloc blocks in NtUnmapViewOfSection.
parent
416cd484
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
virtual.c
dlls/kernel32/tests/virtual.c
+18
-0
virtual.c
dlls/ntdll/virtual.c
+2
-2
No files found.
dlls/kernel32/tests/virtual.c
View file @
1a3777e2
...
...
@@ -748,6 +748,24 @@ static void test_MapViewOfFile(void)
ret
=
UnmapViewOfFile
(
ptr
);
ok
(
ret
,
"UnmapViewOfFile failed with error %d
\n
"
,
GetLastError
());
CloseHandle
(
mapping
);
addr
=
VirtualAlloc
(
NULL
,
0x10000
,
MEM_COMMIT
,
PAGE_READONLY
);
ok
(
addr
!=
NULL
,
"VirtualAlloc failed with error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ok
(
!
UnmapViewOfFile
(
addr
),
"UnmapViewOfFile should fail on VirtualAlloc mem
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_ADDRESS
,
"got %u, expected ERROR_INVALID_ADDRESS
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ok
(
!
UnmapViewOfFile
((
char
*
)
addr
+
0x3000
),
"UnmapViewOfFile should fail on VirtualAlloc mem
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_ADDRESS
,
"got %u, expected ERROR_INVALID_ADDRESS
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ok
(
!
UnmapViewOfFile
((
void
*
)
0xdeadbeef
),
"UnmapViewOfFile should fail on VirtualAlloc mem
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_ADDRESS
,
"got %u, expected ERROR_INVALID_ADDRESS
\n
"
,
GetLastError
());
ok
(
VirtualFree
(
addr
,
0
,
MEM_RELEASE
),
"VirtualFree failed
\n
"
);
}
static
DWORD
(
WINAPI
*
pNtMapViewOfSection
)(
HANDLE
handle
,
HANDLE
process
,
PVOID
*
addr_ptr
,
...
...
dlls/ntdll/virtual.c
View file @
1a3777e2
...
...
@@ -2533,7 +2533,7 @@ done:
NTSTATUS
WINAPI
NtUnmapViewOfSection
(
HANDLE
process
,
PVOID
addr
)
{
FILE_VIEW
*
view
;
NTSTATUS
status
=
STATUS_
INVALID_PARAMETER
;
NTSTATUS
status
=
STATUS_
NOT_MAPPED_VIEW
;
sigset_t
sigset
;
void
*
base
=
ROUND_ADDR
(
addr
,
page_mask
);
...
...
@@ -2552,7 +2552,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
}
server_enter_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
if
((
view
=
VIRTUAL_FindView
(
base
,
0
))
&&
(
base
==
view
->
base
))
if
((
view
=
VIRTUAL_FindView
(
base
,
0
))
&&
(
base
==
view
->
base
)
&&
!
(
view
->
protect
&
VPROT_VALLOC
)
)
{
delete_view
(
view
);
status
=
STATUS_SUCCESS
;
...
...
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