[PATCH 1/4] infosoft/tests: Fix the infinite loop and crash on Windows 10 1607+.

Francois Gouget fgouget at codeweavers.com
Mon May 10 08:53:19 CDT 2021


The test only has expected data for the first four words. So abort if
more are found.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
With this patch, instead of the many many failures and crash we get just 
a handful of failures that show what's wrong. The fixes for those come 
in part 4.

See:
https://test.winehq.org/data/patterns.html#infosoft:infosoft
---
 dlls/infosoft/tests/infosoft.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/dlls/infosoft/tests/infosoft.c b/dlls/infosoft/tests/infosoft.c
index 12bf65a56d3..9ea79008364 100644
--- a/dlls/infosoft/tests/infosoft.c
+++ b/dlls/infosoft/tests/infosoft.c
@@ -70,11 +70,20 @@ static ULONG WINAPI ws_Release(IWordSink *iface)
 static HRESULT WINAPI ws_PutWord(IWordSink *iface, ULONG cwc, const WCHAR *pwcInBuf,
                                  ULONG cwcSrcLen, ULONG cwcSrcPos)
 {
-    ok(testres[wordnum].len == cwcSrcLen, "wrong length\n");
-    ok(!cwcSrcPos ||(testres[wordnum].ofs == cwcSrcPos), "wrong offset\n");
-    ok(!memcmp(testres[wordnum].data, pwcInBuf, cwcSrcLen), "wrong data\n");
+    HRESULT rc = S_OK;
+    if (wordnum < ARRAY_SIZE(testres))
+    {
+        ok(testres[wordnum].len == cwcSrcLen, "wrong length\n");
+        ok(!cwcSrcPos ||(testres[wordnum].ofs == cwcSrcPos), "wrong offset\n");
+        ok(!memcmp(testres[wordnum].data, pwcInBuf, cwcSrcLen), "wrong data\n");
+    }
+    else
+    {
+        ok(0, "found too many words: %d\n", wordnum + 1);
+        rc = E_FAIL;
+    }
     wordnum++;
-    return S_OK;
+    return rc;
 }
 
 static HRESULT WINAPI ws_PutAltWord(IWordSink *iface, ULONG cwc, const WCHAR *pwcInBuf,
-- 
2.20.1




More information about the wine-devel mailing list