]> Savannah Git Hosting - gnulib.git/commitdiff
Add test case from a past musl libc bug.
authorBruno Haible <bruno@clisp.org>
Mon, 27 Mar 2023 13:13:41 +0000 (15:13 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 27 Mar 2023 13:13:41 +0000 (15:13 +0200)
* tests/test-strstr.c (main): Add test of periodic needle.
* tests/test-strcasestr.c (main): Likewise.
* tests/test-c-strstr.c (main): Likewise.
* tests/test-c-strcasestr.c (main): Likewise.
* tests/test-memmem.c (main): Likewise.

ChangeLog
tests/test-c-strcasestr.c
tests/test-c-strstr.c
tests/test-memmem.c
tests/test-strcasestr.c
tests/test-strstr.c

index 6c1419a0fbc37cc6f8d44618655a05fbacd432e1..c17835425ca54d9228d62e11a466a61665688a85 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-03-27  Bruno Haible  <bruno@clisp.org>
+
+       Add test case from a past musl libc bug.
+       * tests/test-strstr.c (main): Add test of periodic needle.
+       * tests/test-strcasestr.c (main): Likewise.
+       * tests/test-c-strstr.c (main): Likewise.
+       * tests/test-c-strcasestr.c (main): Likewise.
+       * tests/test-memmem.c (main): Likewise.
+
 2023-03-27  Bruno Haible  <bruno@clisp.org>
 
        uchar: ISO C 23: Define char8_t.
index 818f5a994b1b3edee6f4295c65c90b79ac183f0d..4f0a6c262aad8fb0a5d522969b41d1ae8da9356b 100644 (file)
@@ -238,6 +238,14 @@ main ()
     free (haystack);
   }
 
+  /* Test case from Yves Bastide.
+     <https://www.openwall.com/lists/musl/2014/04/18/2>  */
+  {
+    const char input[] = "playing PLAY play PLAY always";
+    const char *result = c_strcasestr (input, "play PLAY play");
+    ASSERT (result == input + 8);
+  }
+
   /* Test long needles.  */
   {
     size_t m = 1024;
index d8f8465b29ddd26a1e27d97367f64f0d4b821cf4..30070d70a4ba01a51190d07670f1ee2dabfab5ef 100644 (file)
@@ -212,6 +212,14 @@ main ()
     free (haystack);
   }
 
+  /* Test case from Yves Bastide.
+     <https://www.openwall.com/lists/musl/2014/04/18/2>  */
+  {
+    const char input[] = "playing play play play always";
+    const char *result = c_strstr (input, "play play play");
+    ASSERT (result == input + 8);
+  }
+
   /* Test long needles.  */
   {
     size_t m = 1024;
index 0daf3b07e749d5096a05e3b9da9da93fa3d2e474..589210f4a2fb17589d45c0cbb59f678674f97e66 100644 (file)
@@ -292,6 +292,14 @@ main (int argc, char *argv[])
     free (haystack);
   }
 
+  /* Test case from Yves Bastide.
+     <https://www.openwall.com/lists/musl/2014/04/18/2>  */
+  {
+    const char input[] = "playing play play play always";
+    const char *result = memmem (input, strlen (input), "play play play", 14);
+    ASSERT (result == input + 8);
+  }
+
   /* Test long needles.  */
   {
     size_t m = 1024;
index 192e1569f8ce1478b552085964287d7268094d51..c0f5111b4a41778d0fd0f23b1af08f2597115efb 100644 (file)
@@ -252,6 +252,14 @@ main ()
     free (haystack);
   }
 
+  /* Test case from Yves Bastide.
+     <https://www.openwall.com/lists/musl/2014/04/18/2>  */
+  {
+    const char input[] = "playing PLAY play PLAY always";
+    const char *result = strcasestr (input, "play PLAY play");
+    ASSERT (result == input + 8);
+  }
+
   /* Test long needles.  */
   {
     size_t m = 1024;
index b2e00c526ca305dd4d87965cff412e5ce99fd9dd..1ff9953d31decccc981667c147a6eeb30525bf72 100644 (file)
@@ -275,6 +275,14 @@ main (int argc, char *argv[])
     free (haystack);
   }
 
+  /* Test case from Yves Bastide.
+     <https://www.openwall.com/lists/musl/2014/04/18/2>  */
+  {
+    const char input[] = "playing play play play always";
+    const char *result = strstr (input, "play play play");
+    ASSERT (result == input + 8);
+  }
+
   /* Test long needles.  */
   {
     size_t m = 1024;