From aa5a720056d37cf24924c138a3dbe6dace98e97c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 17 Feb 2022 08:10:35 -0800 Subject: 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 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 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 --- string/test-strncmp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'string') diff --git a/string/test-strncmp.c b/string/test-strncmp.c index df7cea4..1a87f0e 100644 --- a/string/test-strncmp.c +++ b/string/test-strncmp.c @@ -446,6 +446,18 @@ check4 (void) } static void +check5 (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); +} + +static void check_overflow (void) { size_t i, j, of_mask, of_idx; @@ -569,6 +581,7 @@ test_main (void) check2 (); check3 (); check4 (); + check5 (); printf ("%23s", ""); FOR_EACH_IMPL (impl, 0) -- cgit v1.1