[PATCH 2/6] In tests, ensure buffers passed as const pointers are always initialized (GCC11)

Eric Pouech eric.pouech at gmail.com
Tue Sep 28 11:49:38 CDT 2021


Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 dlls/kernelbase/tests/path.c |    1 +
 dlls/msvcirt/tests/msvcirt.c |    5 +++--
 dlls/shlwapi/tests/clist.c   |    1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/kernelbase/tests/path.c b/dlls/kernelbase/tests/path.c
index af511f500f3..b496b75d101 100644
--- a/dlls/kernelbase/tests/path.c
+++ b/dlls/kernelbase/tests/path.c
@@ -1213,6 +1213,7 @@ static void test_PathCchCanonicalizeEx(void)
     }
 
     path_outW[0] = 0xff;
+    memset(path_inW, 0xA5, sizeof(path_inW));
     hr = pPathCchCanonicalizeEx(path_outW, 0, path_inW, 0);
     ok(hr == E_INVALIDARG, "expect hr %#x, got %#x\n", E_INVALIDARG, hr);
     ok(path_outW[0] = 0xff, "expect path_outW unchanged\n");
diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c
index 1a72f5ab954..5e27f92585b 100644
--- a/dlls/msvcirt/tests/msvcirt.c
+++ b/dlls/msvcirt/tests/msvcirt.c
@@ -6816,8 +6816,9 @@ static void test_istrstream(void)
     strstreambuf *pssb;
     char buffer[32];
 
-    memset(&is1, 0xab, sizeof(istream));
-    memset(&is2, 0xab, sizeof(istream));
+    memset(&is1,   0xab, sizeof(istream));
+    memset(&is2,   0xab, sizeof(istream));
+    memset(buffer, 0xab, sizeof(buffer));
 
     /* constructors/destructors */
     pis = call_func4(p_istrstream_buffer_ctor, &is1, buffer, 32, TRUE);
diff --git a/dlls/shlwapi/tests/clist.c b/dlls/shlwapi/tests/clist.c
index 0c914d608e5..acef37a1a1e 100644
--- a/dlls/shlwapi/tests/clist.c
+++ b/dlls/shlwapi/tests/clist.c
@@ -574,6 +574,7 @@ static void test_IStream_Write(void)
     return;
 
   InitDummyStream(&streamobj);
+  memset(buff, 0xA5, sizeof(buff));
   hRet = pIStream_Write(&streamobj.IStream_iface, buff, sizeof(buff));
 
   ok(hRet == S_OK, "failed Write()\n");




More information about the wine-devel mailing list