[PATCH] skip checks if pre condition does not match

Marcus Meissner marcus at jet.franken.de
Sat Mar 22 13:11:33 CDT 2008


spotted by Coverity, we could get negative return values
(or other bad ones) into memcpy().

Just skip the tests if len is not the expected one.

Ciao, Marcus
 dlls/user32/tests/resource.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/resource.c b/dlls/user32/tests/resource.c
index 99fc24f..7190e5c 100644
--- a/dlls/user32/tests/resource.c
+++ b/dlls/user32/tests/resource.c
@@ -91,6 +91,10 @@ static void test_LoadStringA (void)
         ok (len == expected, "bufsiz=%d: got %d, expected %d\n",
             bufsiz, len, expected);
+        if (len != expected) {
+            skip("skipping memcmp and null termination check.\n");
+            continue;
+        }
         ok (!memcmp (buf, str, len),
             "bufsiz=%d: got '%s', expected '%.*s'\n",
             bufsiz, buf, len, str);

More information about the wine-patches mailing list