Nikolay Sivov : dwrite: Filter invalid weight in SetFontWeight().
Alexandre Julliard
julliard at winehq.org
Wed Jul 20 10:28:52 CDT 2016
Module: wine
Branch: master
Commit: 4f01bee4c81f9cbee4b854f47dcccbcda6ca396d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4f01bee4c81f9cbee4b854f47dcccbcda6ca396d
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Jul 19 23:03:01 2016 +0300
dwrite: Filter invalid weight in SetFontWeight().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dwrite/layout.c | 3 +++
dlls/dwrite/tests/layout.c | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
index 22c3f31..6f10ce4 100644
--- a/dlls/dwrite/layout.c
+++ b/dlls/dwrite/layout.c
@@ -2889,6 +2889,9 @@ static HRESULT WINAPI dwritetextlayout_SetFontWeight(IDWriteTextLayout3 *iface,
TRACE("(%p)->(%d %s)\n", This, weight, debugstr_range(&range));
+ if ((UINT32)weight > DWRITE_FONT_WEIGHT_ULTRA_BLACK)
+ return E_INVALIDARG;
+
value.range = range;
value.u.weight = weight;
return set_layout_range_attr(This, LAYOUT_RANGE_ATTR_WEIGHT, &value);
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index 9f3b8c3..4134a97 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -1249,6 +1249,11 @@ static void test_fontweight(void)
ok(weight == DWRITE_FONT_WEIGHT_NORMAL, "got %d\n", weight);
ok(range.length == 6, "got %d\n", range.length);
+ range.startPosition = 0;
+ range.length = 6;
+ hr = IDWriteTextLayout_SetFontWeight(layout, 1000, range);
+ ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
size = IDWriteTextLayout_GetMaxWidth(layout);
ok(size == 100.0, "got %.2f\n", size);
More information about the wine-cvs
mailing list