[v2 PATCH 1/3] dwrite: Sanitize specified stretch value, valid range is [1, 9]
Nikolay Sivov
nsivov at codeweavers.com
Sat Aug 13 14:21:13 CDT 2016
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
v2: use introduced variable, thanks Ken.
dlls/dwrite/opentype.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index b35f1df..7f4a208 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -1291,9 +1291,10 @@ void opentype_get_font_properties(struct file_stream_desc *stream_desc, struct d
USHORT version = GET_BE_WORD(tt_os2->version);
USHORT fsSelection = GET_BE_WORD(tt_os2->fsSelection);
USHORT usWeightClass = GET_BE_WORD(tt_os2->usWeightClass);
+ USHORT usWidthClass = GET_BE_WORD(tt_os2->usWidthClass);
- if (GET_BE_WORD(tt_os2->usWidthClass) <= DWRITE_FONT_STRETCH_ULTRA_EXPANDED)
- props->stretch = GET_BE_WORD(tt_os2->usWidthClass);
+ if (usWidthClass > DWRITE_FONT_STRETCH_UNDEFINED && usWidthClass <= DWRITE_FONT_STRETCH_ULTRA_EXPANDED)
+ props->stretch = usWidthClass;
if (usWeightClass >= 1 && usWeightClass <= 9)
usWeightClass *= 100;
--
2.8.1
More information about the wine-patches
mailing list