[PATCH 3/3] dwrite: Protect from space-only strings when trimming away spaces

Nikolay Sivov nsivov at codeweavers.com
Tue Aug 18 15:49:50 CDT 2015


---

-------------- next part --------------
>From 5a09582554b61e65cb1b81b46859610d7745adc4 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue, 18 Aug 2015 23:03:28 +0300
Subject: [PATCH 3/3] 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 7e88a2f..a0596ea 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--;
 
-- 
2.1.4



More information about the wine-patches mailing list