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
c3b4fe39
Commit
c3b4fe39
authored
Dec 17, 2006
by
Rob Shearman
Committed by
Alexandre Julliard
Dec 18, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Protect global alloc functions against integer overflows on the size parameter.
parent
fb883d86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
heap.c
dlls/kernel32/heap.c
+18
-2
No files found.
dlls/kernel32/heap.c
View file @
c3b4fe39
...
...
@@ -365,6 +365,12 @@ HGLOBAL WINAPI GlobalAlloc(
}
else
/* HANDLE */
{
if
(
size
>
INT_MAX
-
HGLOBAL_STORAGE
)
{
SetLastError
(
ERROR_OUTOFMEMORY
);
return
0
;
}
RtlLockHeap
(
GetProcessHeap
());
pintern
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLOBAL32_INTERN
));
...
...
@@ -658,7 +664,12 @@ HGLOBAL WINAPI GlobalReAlloc(
hnew
=
hmem
;
if
(
pintern
->
Pointer
)
{
if
((
palloc
=
HeapReAlloc
(
GetProcessHeap
(),
heap_flags
,
if
(
size
>
INT_MAX
-
HGLOBAL_STORAGE
)
{
SetLastError
(
ERROR_OUTOFMEMORY
);
hnew
=
0
;
}
else
if
((
palloc
=
HeapReAlloc
(
GetProcessHeap
(),
heap_flags
,
(
char
*
)
pintern
->
Pointer
-
HGLOBAL_STORAGE
,
size
+
HGLOBAL_STORAGE
))
==
NULL
)
hnew
=
0
;
/* Block still valid */
...
...
@@ -667,7 +678,12 @@ HGLOBAL WINAPI GlobalReAlloc(
}
else
{
if
((
palloc
=
HeapAlloc
(
GetProcessHeap
(),
heap_flags
,
size
+
HGLOBAL_STORAGE
))
if
(
size
>
INT_MAX
-
HGLOBAL_STORAGE
)
{
SetLastError
(
ERROR_OUTOFMEMORY
);
hnew
=
0
;
}
else
if
((
palloc
=
HeapAlloc
(
GetProcessHeap
(),
heap_flags
,
size
+
HGLOBAL_STORAGE
))
==
NULL
)
hnew
=
0
;
else
...
...
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