Esme Povirk : dwrite: Fix possible use of uninitialized memory.

Alexandre Julliard julliard at winehq.org
Mon Dec 13 15:59:53 CST 2021


Module: wine
Branch: master
Commit: 07fd82cdbddc03da2095882fa4fdaf7928c90fbc
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=07fd82cdbddc03da2095882fa4fdaf7928c90fbc

Author: Esme Povirk <esme at codeweavers.com>
Date:   Sat Dec 11 14:04:27 2021 -0600

dwrite: Fix possible use of uninitialized memory.

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>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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)




More information about the wine-cvs mailing list