[PATCH 1/2] dwrite: Sanitize specified stretch value, valid range is [1, 9]

Ken Thomases ken at codeweavers.com
Sat Aug 13 12:36:32 CDT 2016


On Aug 13, 2016, at 4:47 AM, Nikolay Sivov <nsivov at codeweavers.com> wrote:
> 
> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
> ---
> dlls/dwrite/opentype.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
> index b35f1df..ff23f51 100644
> --- a/dlls/dwrite/opentype.c
> +++ b/dlls/dwrite/opentype.c
> @@ -1291,8 +1291,9 @@ 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)
> +        if (usWidthClass > DWRITE_FONT_STRETCH_UNDEFINED && usWidthClass <= DWRITE_FONT_STRETCH_ULTRA_EXPANDED)
>             props->stretch = GET_BE_WORD(tt_os2->usWidthClass);

Shouldn't you use the new usWidthClass variable in the assignment here, too?

-Ken




More information about the wine-devel mailing list