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
84d0c4f0
Commit
84d0c4f0
authored
Mar 02, 2016
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Mar 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Don't crash in DrawTextEx when tab length is zero.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
48bf99ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
text.c
dlls/user32/tests/text.c
+38
-1
text.c
dlls/user32/text.c
+1
-1
No files found.
dlls/user32/tests/text.c
View file @
84d0c4f0
...
...
@@ -44,8 +44,9 @@ static void test_DrawTextCalcRect(void)
static
WCHAR
emptystringW
[]
=
{
0
};
static
CHAR
wordbreak_text
[]
=
"line1 line2"
;
static
WCHAR
wordbreak_textW
[]
=
{
'l'
,
'i'
,
'n'
,
'e'
,
'1'
,
' '
,
'l'
,
'i'
,
'n'
,
'e'
,
'2'
,
0
};
static
char
tabstring
[]
=
"one
\t
two"
;
INT
textlen
,
textheight
,
heightcheck
;
RECT
rect
=
{
0
,
0
,
100
,
0
};
RECT
rect
=
{
0
,
0
,
100
,
0
}
,
rect2
;
BOOL
ret
;
DRAWTEXTPARAMS
dtp
;
BOOL
conform_xp
=
TRUE
;
...
...
@@ -580,6 +581,42 @@ static void test_DrawTextCalcRect(void)
ok
(
textheight
>=
heightcheck
*
6
,
"Got unexpected textheight %d, expected at least %d.
\n
"
,
textheight
,
heightcheck
*
6
);
/* DT_TABSTOP | DT_EXPANDTABS tests */
SetRect
(
&
rect
,
0
,
0
,
10
,
10
);
textheight
=
DrawTextA
(
hdc
,
tabstring
,
-
1
,
&
rect
,
DT_TABSTOP
|
DT_EXPANDTABS
);
ok
(
textheight
>=
heightcheck
,
"Got unexpected textheight %d
\n
"
,
textheight
);
SetRect
(
&
rect
,
0
,
0
,
10
,
10
);
memset
(
&
dtp
,
0
,
sizeof
(
dtp
));
dtp
.
cbSize
=
sizeof
(
dtp
);
textheight
=
DrawTextExA
(
hdc
,
tabstring
,
-
1
,
&
rect
,
DT_CALCRECT
,
&
dtp
);
ok
(
textheight
>=
heightcheck
,
"Got unexpected textheight %d
\n
"
,
textheight
);
ok
(
dtp
.
iTabLength
==
0
,
"invalid dtp.iTabLength = %i
\n
"
,
dtp
.
iTabLength
);
SetRect
(
&
rect2
,
0
,
0
,
10
,
10
);
memset
(
&
dtp
,
0
,
sizeof
(
dtp
));
dtp
.
cbSize
=
sizeof
(
dtp
);
textheight
=
DrawTextExA
(
hdc
,
tabstring
,
-
1
,
&
rect2
,
DT_CALCRECT
|
DT_TABSTOP
|
DT_EXPANDTABS
,
&
dtp
);
ok
(
textheight
>=
heightcheck
,
"Got unexpected textheight %d
\n
"
,
textheight
);
ok
(
dtp
.
iTabLength
==
0
,
"invalid dtp.iTabLength = %i
\n
"
,
dtp
.
iTabLength
);
ok
(
rect
.
left
==
rect2
.
left
&&
rect
.
right
!=
rect2
.
right
&&
rect
.
top
==
rect2
.
top
&&
rect
.
bottom
==
rect2
.
bottom
,
"incorrect rect %d,%d-%d,%d rect2 %d,%d-%d,%d
\n
"
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
,
rect2
.
left
,
rect2
.
top
,
rect2
.
right
,
rect2
.
bottom
);
SetRect
(
&
rect
,
0
,
0
,
10
,
10
);
memset
(
&
dtp
,
0
,
sizeof
(
dtp
));
dtp
.
cbSize
=
sizeof
(
dtp
);
dtp
.
iTabLength
=
8
;
textheight
=
DrawTextExA
(
hdc
,
tabstring
,
-
1
,
&
rect
,
DT_CALCRECT
|
DT_TABSTOP
|
DT_EXPANDTABS
,
&
dtp
);
ok
(
textheight
>=
heightcheck
,
"Got unexpected textheight %d
\n
"
,
textheight
);
ok
(
dtp
.
iTabLength
==
8
,
"invalid dtp.iTabLength = %i
\n
"
,
dtp
.
iTabLength
);
ok
(
rect
.
left
==
rect2
.
left
,
"unexpected value %d, got %d
\n
"
,
rect
.
left
,
rect2
.
left
);
/* XP, 2003 appear to not give the same values. */
ok
(
rect
.
right
==
rect2
.
right
||
broken
(
rect
.
right
>
rect2
.
right
),
"unexpected value %d, got %d
\n
"
,
rect
.
right
,
rect2
.
right
);
ok
(
rect
.
top
==
rect2
.
top
,
"unexpected value %d, got %d
\n
"
,
rect
.
top
,
rect2
.
top
);
ok
(
rect
.
bottom
==
rect2
.
bottom
,
"unexpected value %d, got %d
\n
"
,
rect
.
bottom
,
rect2
.
bottom
);
SelectObject
(
hdc
,
hOldFont
);
ret
=
DeleteObject
(
hFont
);
ok
(
ret
,
"DeleteObject error %u
\n
"
,
GetLastError
());
...
...
dlls/user32/text.c
View file @
84d0c4f0
...
...
@@ -948,7 +948,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
if
(
flags
&
DT_EXPANDTABS
)
{
int
tabstop
=
((
flags
&
DT_TABSTOP
)
&&
dtp
)
?
dtp
->
iTabLength
:
8
;
int
tabstop
=
((
flags
&
DT_TABSTOP
)
&&
dtp
&&
dtp
->
iTabLength
)
?
dtp
->
iTabLength
:
8
;
tabwidth
=
tm
.
tmAveCharWidth
*
tabstop
;
}
...
...
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