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
24f7869e
Commit
24f7869e
authored
Dec 15, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Enforce a mapping size limit instead of relying on the Unix file system.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55667
parent
3504f138
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
file.c
dlls/kernel32/tests/file.c
+8
-5
mapping.c
server/mapping.c
+1
-1
No files found.
dlls/kernel32/tests/file.c
View file @
24f7869e
...
@@ -3105,6 +3105,7 @@ static void test_MapFile(void)
...
@@ -3105,6 +3105,7 @@ static void test_MapFile(void)
{
{
HANDLE
handle
;
HANDLE
handle
;
HANDLE
hmap
;
HANDLE
hmap
;
UINT
err
;
ok
(
test_Mapfile_createtemp
(
&
handle
),
"Couldn't create test file.
\n
"
);
ok
(
test_Mapfile_createtemp
(
&
handle
),
"Couldn't create test file.
\n
"
);
...
@@ -3123,15 +3124,17 @@ static void test_MapFile(void)
...
@@ -3123,15 +3124,17 @@ static void test_MapFile(void)
ok
(
test_Mapfile_createtemp
(
&
handle
),
"Couldn't create test file.
\n
"
);
ok
(
test_Mapfile_createtemp
(
&
handle
),
"Couldn't create test file.
\n
"
);
SetLastError
(
0xdeadbeef
);
hmap
=
CreateFileMappingA
(
handle
,
NULL
,
PAGE_READWRITE
,
0
,
0
,
NULL
);
hmap
=
CreateFileMappingA
(
handle
,
NULL
,
PAGE_READWRITE
,
0
,
0
,
NULL
);
err
=
GetLastError
();
ok
(
hmap
==
NULL
,
"mapped zero size file
\n
"
);
ok
(
hmap
==
NULL
,
"mapped zero size file
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_INVALID
,
"not ERROR_FILE_INVALID
\n
"
);
ok
(
err
==
ERROR_FILE_INVALID
,
"got %u
\n
"
,
err
);
hmap
=
CreateFileMappingA
(
handle
,
NULL
,
PAGE_READWRITE
,
0x80000
,
0
,
NULL
);
ok
(
hmap
==
NULL
,
"mapping should fail
\n
"
);
hmap
=
CreateFileMappingA
(
handle
,
NULL
,
PAGE_READWRITE
,
0x80000
,
0x10000
,
NULL
);
SetLastError
(
0xdeadbeef
);
hmap
=
CreateFileMappingA
(
handle
,
NULL
,
PAGE_READWRITE
,
0x8000000
,
0x10000
,
NULL
);
err
=
GetLastError
();
ok
(
hmap
==
NULL
,
"mapping should fail
\n
"
);
ok
(
hmap
==
NULL
,
"mapping should fail
\n
"
);
ok
(
err
==
ERROR_NOT_ENOUGH_MEMORY
||
err
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
err
);
/* On XP you can now map again, on Win 95 you cannot. */
/* On XP you can now map again, on Win 95 you cannot. */
...
...
server/mapping.c
View file @
24f7869e
...
@@ -993,7 +993,7 @@ static struct mapping *create_mapping( struct object *root, const struct unicode
...
@@ -993,7 +993,7 @@ static struct mapping *create_mapping( struct object *root, const struct unicode
}
}
else
if
(
st
.
st_size
<
mapping
->
size
)
else
if
(
st
.
st_size
<
mapping
->
size
)
{
{
if
(
!
(
file_access
&
FILE_WRITE_DATA
))
if
(
!
(
file_access
&
FILE_WRITE_DATA
)
||
mapping
->
size
>>
54
/* ntfs limit */
)
{
{
set_error
(
STATUS_SECTION_TOO_BIG
);
set_error
(
STATUS_SECTION_TOO_BIG
);
goto
error
;
goto
error
;
...
...
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