about summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-02-17 08:10:35 -0800
committerH.J. Lu <hjl.tools@gmail.com>2022-02-17 11:33:07 -0800
commit775c05b28c1883c5860f582cca68abf9036d9ace (patch)
tree7bd2cf63548f784180f7fa6d9c9b1dc7e9108e48
parentc6b346ec551fd82bb1c8d724c73cbd5c2980e0c7 (diff)
downloadglibc-775c05b28c1883c5860f582cca68abf9036d9ace.tar.gz
glibc-775c05b28c1883c5860f582cca68abf9036d9ace.tar.xz
glibc-775c05b28c1883c5860f582cca68abf9036d9ace.zip
string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
fails without

commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Sun Jan 9 16:02:21 2022 -0600

    x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]

and

commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Sun Jan 9 16:02:28 2022 -0600

    x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]

This is for BZ #28755.

Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>

(cherry picked from commit aa5a720056d37cf24924c138a3dbe6dace98e97c)
-rw-r--r--string/test-strncmp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/string/test-strncmp.c b/string/test-strncmp.c
index d961ac4493..02806f4ebd 100644
--- a/string/test-strncmp.c
+++ b/string/test-strncmp.c
@@ -403,6 +403,18 @@ check2 (void)
   free (s2);
 }
 
+static void
+check3 (void)
+{
+  const CHAR *s1 = L ("abc");
+  CHAR *s2 = STRDUP (s1);
+
+  FOR_EACH_IMPL (impl, 0)
+    check_result (impl, s1, s2, SIZE_MAX, 0);
+
+  free (s2);
+}
+
 int
 test_main (void)
 {
@@ -412,6 +424,7 @@ test_main (void)
 
   check1 ();
   check2 ();
+  check3 ();
 
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)