From 1f54400bbf35de4f892468b78544951c3dc8f968 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 18 Aug 2015 23:49:50 +0300 Subject: [PATCH] dwrite: Protect from space-only strings when trimming away spaces. --- dlls/dwrite/font.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 7e88a2f65ce..a0596eae901 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -1967,7 +1967,10 @@ static int trim_spaces(WCHAR *in, WCHAR *ret) while (isspaceW(*in)) in++; - len = strlenW(in); + ret[0] = 0; + if (!(len = strlenW(in))) + return 0; + while (isspaceW(in[len-1])) len--;