[PATCH 2/3] dwrite: Fix possible use of uninitialized memory.

Esme Povirk esme at codeweavers.com
Sat Dec 11 14:04:27 CST 2021


If the text source returns fewer than length character, part
of the buffer will be uninitialized.

Signed-off-by: Esme Povirk <esme at codeweavers.com>
---
 dlls/dwrite/analyzer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index 8ecfad5f3a5..92a02f8d3aa 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -865,7 +865,7 @@ static HRESULT get_text_source_ptr(IDWriteTextAnalysisSource *source, UINT32 pos
     if (len < length) {
         UINT32 read;
 
-        *buff = malloc(length * sizeof(WCHAR));
+        *buff = calloc(length, sizeof(WCHAR));
         if (!*buff)
             return E_OUTOFMEMORY;
         if (*text)
-- 
2.25.1




More information about the wine-devel mailing list