This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/4] Detect EOL on-the-fly in strstr, strcasestr and memmem.
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: Maxim Kuvyrkov <maxim at codesourcery dot com>, "Carlos O'Donell" <carlos at codesourcery dot com>, GLIBC Devel <libc-alpha at sourceware dot org>, Eric Blake <eblake at redhat dot com>, Ryan Arnold <rsa at us dot ibm dot com>
- Date: Fri, 5 Oct 2012 13:05:45 -0700
- Subject: Re: [PATCH 2/4] Detect EOL on-the-fly in strstr, strcasestr and memmem.
- References: <2C516CF2-D083-4C1D-AD27-6A31D381D548@codesourcery.com><54BDEEA0-E48A-4562-89AD-FCB848BFB9CF@codesourcery.com><CAMe9rOqingoVVs9MmqxKyUh4k0fLOzitKJ-7700hsQp39Xt6xA@mail.gmail.com><20121005195823.E5FA92C0B1@topped-with-meat.com>
On Fri, Oct 5, 2012 at 12:58 PM, Roland McGrath <roland@hack.frob.com> wrote:
> Please put the test case in. It gives us a state where 'make check' fails,
> but IMHO that's better than allowing the possibility of the bug going
> unfixed and unnoticed for much longer.
I'd like to check in:
http://sourceware.org/ml/libc-alpha/2012-10/msg00168.html
to run strcasestr/strchr/strstr test under all implementations.
This test case then becomes:
[BZ #14602]
* string/test-strstr.c (check2): New function.
(test_main): Call check2.
diff --git a/string/test-strstr.c b/string/test-strstr.c
index 24f3eb5..53b20d7 100644
--- a/string/test-strstr.c
+++ b/string/test-strstr.c
@@ -157,12 +157,24 @@ check1 (void)
check_result (impl, s1, s2, exp_result);
}
+static void
+check2 (void)
+{
+ const char s1[] = ", enable_static, \0, enable_shared, ";
+ char *exp_result;
+
+ exp_result = stupid_strstr (s1, s1 + 18);
+ FOR_EACH_IMPL (impl, 0)
+ check_result (impl, s1, s1 + 18, exp_result);
+}
+
static int
test_main (void)
{
test_init ();
check1 ();
+ check2 ();
printf ("%23s", "");
FOR_EACH_IMPL (impl, 0)
--
--
H.J.