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
fee64bed
Commit
fee64bed
authored
Jul 18, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Validate CreateTextFormat() arguments.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
84a36f27
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
layout.c
dlls/dwrite/layout.c
+8
-0
layout.c
dlls/dwrite/tests/layout.c
+29
-0
No files found.
dlls/dwrite/layout.c
View file @
fee64bed
...
@@ -5133,6 +5133,14 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
...
@@ -5133,6 +5133,14 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
*
format
=
NULL
;
*
format
=
NULL
;
if
(
size
<=
0
.
0
f
)
return
E_INVALIDARG
;
if
(((
UINT32
)
weight
>
DWRITE_FONT_WEIGHT_ULTRA_BLACK
)
||
((
UINT32
)
stretch
>
DWRITE_FONT_STRETCH_ULTRA_EXPANDED
)
||
((
UINT32
)
style
>
DWRITE_FONT_STYLE_ITALIC
))
return
E_INVALIDARG
;
This
=
heap_alloc
(
sizeof
(
struct
dwrite_textformat
));
This
=
heap_alloc
(
sizeof
(
struct
dwrite_textformat
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
...
dlls/dwrite/tests/layout.c
View file @
fee64bed
...
@@ -933,6 +933,7 @@ static void test_CreateGdiCompatibleTextLayout(void)
...
@@ -933,6 +933,7 @@ static void test_CreateGdiCompatibleTextLayout(void)
static
void
test_CreateTextFormat
(
void
)
static
void
test_CreateTextFormat
(
void
)
{
{
static
const
WCHAR
emptyW
[]
=
{
0
};
IDWriteFontCollection
*
collection
,
*
syscoll
;
IDWriteFontCollection
*
collection
,
*
syscoll
;
DWRITE_PARAGRAPH_ALIGNMENT
paralign
;
DWRITE_PARAGRAPH_ALIGNMENT
paralign
;
DWRITE_READING_DIRECTION
readdir
;
DWRITE_READING_DIRECTION
readdir
;
...
@@ -949,6 +950,34 @@ static void test_CreateTextFormat(void)
...
@@ -949,6 +950,34 @@ static void test_CreateTextFormat(void)
factory
=
create_factory
();
factory
=
create_factory
();
/* zero/negative font size */
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
0
.
0
f
,
enusW
,
&
format
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
-
10
.
0
f
,
enusW
,
&
format
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
/* invalid font properties */
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
1000
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
f
,
enusW
,
&
format
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_ITALIC
+
1
,
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
f
,
enusW
,
&
format
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_ITALIC
,
10
,
10
.
0
f
,
enusW
,
&
format
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
/* empty family name */
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
emptyW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
f
,
enusW
,
&
format
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteTextFormat_Release
(
format
);
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
,
enusW
,
&
format
);
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
,
enusW
,
&
format
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
...
...
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