]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
introduce a test for n-i-bz fix bug in strspn replacement
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 28 Oct 2017 13:02:11 +0000 (15:02 +0200)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 28 Oct 2017 13:02:11 +0000 (15:02 +0200)
c1eace647ca4f670ef9bec0d0fe72cdd25a96394 fixed a bug in strspn replacement.
Add a test to cover this fix.

memcheck/tests/str_tester.c

index 9f7790a915b8dc10308974f31517575db3fb2ddc..8a49428c8d1597921e80bc54960589518d3eca76 100644 (file)
@@ -710,6 +710,15 @@ test_strspn (void)
   check(strspn("abc", "qx") == 0, 3);  /* None. */
   check(strspn("", "ab") == 0, 4);     /* Null string. */
   check(strspn("abc", "") == 0, 5);    /* Null search list. */
+  {
+     unsigned char work4[4];
+     work4[0] = 0xe2;
+     work4[1] = 0xe3;
+     work4[2] = 0xd9;
+     work4[3] = '\0';
+     /* Check for signed/unsigned mixup */
+     check(strspn((char*)work4, (char*)work4) == 3, 6);
+  }
 }
 
 static void