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
8e8cdc78
Commit
8e8cdc78
authored
Dec 01, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add more parameter checks in GdiGradientFill.
parent
7ea59c10
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
painting.c
dlls/gdi32/painting.c
+5
-2
bitmap.c
dlls/gdi32/tests/bitmap.c
+29
-0
No files found.
dlls/gdi32/painting.c
View file @
8e8cdc78
...
...
@@ -1219,11 +1219,12 @@ POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut )
* GdiGradientFill (GDI32.@)
*/
BOOL
WINAPI
GdiGradientFill
(
HDC
hdc
,
TRIVERTEX
*
vert_array
,
ULONG
nvert
,
void
*
grad_array
,
ULONG
ngrad
,
ULONG
mode
)
void
*
grad_array
,
ULONG
ngrad
,
ULONG
mode
)
{
DC
*
dc
;
PHYSDEV
physdev
;
BOOL
ret
;
ULONG
i
;
TRACE
(
"%p vert_array:%p nvert:%d grad_array:%p ngrad:%d
\n
"
,
hdc
,
vert_array
,
nvert
,
grad_array
,
ngrad
);
...
...
@@ -1232,12 +1233,14 @@ BOOL WINAPI GdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
for
(
i
=
0
;
i
<
ngrad
*
(
mode
==
GRADIENT_FILL_TRIANGLE
?
3
:
2
);
i
++
)
if
(((
ULONG
*
)
grad_array
)[
i
]
>=
nvert
)
return
FALSE
;
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
update_dc
(
dc
);
physdev
=
GET_DC_PHYSDEV
(
dc
,
pGradientFill
);
ret
=
physdev
->
funcs
->
pGradientFill
(
physdev
,
vert_array
,
nvert
,
grad_array
,
ngrad
,
mode
);
...
...
dlls/gdi32/tests/bitmap.c
View file @
8e8cdc78
...
...
@@ -3417,6 +3417,17 @@ static void test_GdiGradientFill(void)
ok
(
!
ret
,
"GdiGradientFill succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pGdiGradientFill
(
hdc
,
vt
,
3
,
rect
,
3
,
GRADIENT_FILL_RECT_H
);
ok
(
!
ret
,
"GdiGradientFill succeeded
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
rect
[
2
].
UpperLeft
=
rect
[
2
].
LowerRight
=
1
;
SetLastError
(
0xdeadbeef
);
ret
=
pGdiGradientFill
(
hdc
,
vt
,
3
,
rect
,
3
,
GRADIENT_FILL_RECT_H
);
ok
(
ret
,
"GdiGradientFill failed err %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pGdiGradientFill
(
hdc
,
vt
,
1
,
rect
,
1
,
GRADIENT_FILL_RECT_H
);
ok
(
ret
,
"GdiGradientFill failed err %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pGdiGradientFill
(
hdc
,
vt
,
1
,
tri
,
0
,
GRADIENT_FILL_TRIANGLE
);
ok
(
!
ret
,
"GdiGradientFill succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
...
...
@@ -3429,6 +3440,24 @@ static void test_GdiGradientFill(void)
SetLastError
(
0xdeadbeef
);
ret
=
pGdiGradientFill
(
hdc
,
vt
,
3
,
tri
,
3
,
GRADIENT_FILL_TRIANGLE
);
ok
(
ret
,
"GdiGradientFill failed err %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pGdiGradientFill
(
hdc
,
vt
,
3
,
tri
,
4
,
GRADIENT_FILL_TRIANGLE
);
ok
(
!
ret
,
"GdiGradientFill succeeded
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
tri
[
3
].
Vertex3
=
1
;
SetLastError
(
0xdeadbeef
);
ret
=
pGdiGradientFill
(
hdc
,
vt
,
3
,
tri
,
4
,
GRADIENT_FILL_TRIANGLE
);
ok
(
!
ret
,
"GdiGradientFill succeeded
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
tri
[
3
].
Vertex3
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
pGdiGradientFill
(
hdc
,
vt
,
3
,
tri
,
4
,
GRADIENT_FILL_TRIANGLE
);
ok
(
!
ret
,
"GdiGradientFill succeeded
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
tri
[
3
].
Vertex1
=
tri
[
3
].
Vertex2
=
tri
[
3
].
Vertex3
=
1
;
SetLastError
(
0xdeadbeef
);
ret
=
pGdiGradientFill
(
hdc
,
vt
,
3
,
tri
,
4
,
GRADIENT_FILL_TRIANGLE
);
ok
(
ret
,
"GdiGradientFill failed err %u
\n
"
,
GetLastError
()
);
DeleteDC
(
hdc
);
DeleteObject
(
bmp
);
...
...
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