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
7be11594
Commit
7be11594
authored
Jun 06, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Validate per-range attribute values.
parent
496aec11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
layout.c
dlls/dwrite/layout.c
+9
-0
layout.c
dlls/dwrite/tests/layout.c
+27
-1
No files found.
dlls/dwrite/layout.c
View file @
7be11594
...
...
@@ -1937,6 +1937,9 @@ static HRESULT WINAPI dwritetextlayout_SetFontStyle(IDWriteTextLayout2 *iface, D
TRACE
(
"(%p)->(%d %s)
\n
"
,
This
,
style
,
debugstr_range
(
&
range
));
if
((
UINT32
)
style
>
DWRITE_FONT_STYLE_ITALIC
)
return
E_INVALIDARG
;
value
.
range
=
range
;
value
.
u
.
style
=
style
;
return
set_layout_range_attr
(
This
,
LAYOUT_RANGE_ATTR_STYLE
,
&
value
);
...
...
@@ -1949,6 +1952,9 @@ static HRESULT WINAPI dwritetextlayout_SetFontStretch(IDWriteTextLayout2 *iface,
TRACE
(
"(%p)->(%d %s)
\n
"
,
This
,
stretch
,
debugstr_range
(
&
range
));
if
(
stretch
==
DWRITE_FONT_STRETCH_UNDEFINED
||
(
UINT32
)
stretch
>
DWRITE_FONT_STRETCH_ULTRA_EXPANDED
)
return
E_INVALIDARG
;
value
.
range
=
range
;
value
.
u
.
stretch
=
stretch
;
return
set_layout_range_attr
(
This
,
LAYOUT_RANGE_ATTR_STRETCH
,
&
value
);
...
...
@@ -1961,6 +1967,9 @@ static HRESULT WINAPI dwritetextlayout_SetFontSize(IDWriteTextLayout2 *iface, FL
TRACE
(
"(%p)->(%.2f %s)
\n
"
,
This
,
size
,
debugstr_range
(
&
range
));
if
(
size
<=
0
.
0
)
return
E_INVALIDARG
;
value
.
range
=
range
;
value
.
u
.
fontsize
=
size
;
return
set_layout_range_attr
(
This
,
LAYOUT_RANGE_ATTR_FONTSIZE
,
&
value
);
...
...
dlls/dwrite/tests/layout.c
View file @
7be11594
...
...
@@ -1832,6 +1832,15 @@ static void test_SetFontSize(void)
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
strW
,
4
,
format
,
1000
.
0
,
1000
.
0
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* negative/zero size */
r
.
startPosition
=
1
;
r
.
length
=
1
;
hr
=
IDWriteTextLayout_SetFontSize
(
layout
,
-
15
.
0
,
r
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextLayout_SetFontSize
(
layout
,
0
.
0
,
r
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
r
.
startPosition
=
1
;
r
.
length
=
0
;
size
=
0
.
0
;
...
...
@@ -1909,6 +1918,12 @@ static void test_SetFontFamilyName(void)
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
strW
,
4
,
format
,
1000
.
0
,
1000
.
0
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* NULL name */
r
.
startPosition
=
1
;
r
.
length
=
1
;
hr
=
IDWriteTextLayout_SetFontFamilyName
(
layout
,
NULL
,
r
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
r
.
startPosition
=
1
;
r
.
length
=
0
;
nameW
[
0
]
=
0
;
...
...
@@ -1961,6 +1976,12 @@ static void test_SetFontStyle(void)
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
strW
,
4
,
format
,
1000
.
0
,
1000
.
0
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* invalid style value */
r
.
startPosition
=
1
;
r
.
length
=
1
;
hr
=
IDWriteTextLayout_SetFontStyle
(
layout
,
DWRITE_FONT_STYLE_ITALIC
+
1
,
r
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
r
.
startPosition
=
1
;
r
.
length
=
0
;
hr
=
IDWriteTextLayout_GetFontStyle
(
layout
,
0
,
&
style
,
&
r
);
...
...
@@ -2036,6 +2057,12 @@ static void test_SetFontStretch(void)
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
strW
,
4
,
format
,
1000
.
0
,
1000
.
0
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* invalid stretch value */
r
.
startPosition
=
1
;
r
.
length
=
1
;
hr
=
IDWriteTextLayout_SetFontStretch
(
layout
,
DWRITE_FONT_STRETCH_ULTRA_EXPANDED
+
1
,
r
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
r
.
startPosition
=
1
;
r
.
length
=
0
;
stretch
=
DWRITE_FONT_STRETCH_UNDEFINED
;
...
...
@@ -2093,7 +2120,6 @@ static void test_SetFontStretch(void)
r
.
startPosition
=
0
;
r
.
length
=
2
;
hr
=
IDWriteTextLayout_SetFontStretch
(
layout
,
DWRITE_FONT_STRETCH_UNDEFINED
,
r
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
IDWriteTextLayout_Release
(
layout
);
...
...
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