Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
ee89ce29
Commit
ee89ce29
authored
13 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
gdi32: Add sanity checks for brush hatch styles.
parent
8bf48557
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/gdi32/brush.c
+8
-0
8 additions, 0 deletions
dlls/gdi32/brush.c
dlls/gdi32/tests/brush.c
+37
-0
37 additions, 0 deletions
dlls/gdi32/tests/brush.c
include/wingdi.h
+1
-0
1 addition, 0 deletions
include/wingdi.h
with
46 additions
and
0 deletions
dlls/gdi32/brush.c
+
8
−
0
View file @
ee89ce29
...
...
@@ -149,7 +149,15 @@ BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern )
{
case
BS_SOLID
:
case
BS_HOLLOW
:
return
TRUE
;
case
BS_HATCHED
:
if
(
brush
->
lbHatch
>
HS_DIAGCROSS
)
{
if
(
brush
->
lbHatch
>=
HS_API_MAX
)
return
FALSE
;
brush
->
lbStyle
=
BS_SOLID
;
brush
->
lbHatch
=
0
;
}
return
TRUE
;
case
BS_PATTERN8X8
:
...
...
This diff is collapsed.
Click to expand it.
dlls/gdi32/tests/brush.c
+
37
−
0
View file @
ee89ce29
...
...
@@ -79,6 +79,42 @@ static void test_solidbrush(void)
}
}
static
void
test_hatch_brush
(
void
)
{
int
i
,
size
;
HBRUSH
brush
;
LOGBRUSH
lb
;
for
(
i
=
0
;
i
<
20
;
i
++
)
{
SetLastError
(
0xdeadbeef
);
brush
=
CreateHatchBrush
(
i
,
RGB
(
12
,
34
,
56
)
);
if
(
i
<
HS_API_MAX
)
{
ok
(
brush
!=
0
,
"%u: CreateHatchBrush failed err %u
\n
"
,
i
,
GetLastError
()
);
size
=
GetObject
(
brush
,
sizeof
(
lb
),
&
lb
);
ok
(
size
==
sizeof
(
lb
),
"wrong size %u
\n
"
,
size
);
ok
(
lb
.
lbColor
==
RGB
(
12
,
34
,
56
),
"wrong color %08x
\n
"
,
lb
.
lbColor
);
if
(
i
<=
HS_DIAGCROSS
)
{
ok
(
lb
.
lbStyle
==
BS_HATCHED
,
"wrong style %u
\n
"
,
lb
.
lbStyle
);
ok
(
lb
.
lbHatch
==
i
,
"wrong hatch %lu/%u
\n
"
,
lb
.
lbHatch
,
i
);
}
else
{
ok
(
lb
.
lbStyle
==
BS_SOLID
,
"wrong style %u
\n
"
,
lb
.
lbStyle
);
ok
(
lb
.
lbHatch
==
0
,
"wrong hatch %lu
\n
"
,
lb
.
lbHatch
);
}
DeleteObject
(
brush
);
}
else
{
ok
(
!
brush
,
"%u: CreateHatchBrush succeeded
\n
"
,
i
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
}
}
}
static
void
test_pattern_brush
(
void
)
{
char
buffer
[
sizeof
(
BITMAPINFOHEADER
)
+
2
*
sizeof
(
RGBQUAD
)
+
32
*
32
/
8
];
...
...
@@ -310,6 +346,7 @@ static void test_palette_brush(void)
START_TEST
(
brush
)
{
test_solidbrush
();
test_hatch_brush
();
test_pattern_brush
();
test_palette_brush
();
}
This diff is collapsed.
Click to expand it.
include/wingdi.h
+
1
−
0
View file @
ee89ce29
...
...
@@ -526,6 +526,7 @@ typedef LOGBRUSH PATTERN, *PPATTERN, *LPPATTERN;
#define HS_BDIAGONAL 3
#define HS_CROSS 4
#define HS_DIAGCROSS 5
#define HS_API_MAX 12
/* Fonts */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment