[Bug string/23637] Generic strstr/strcasestr fails with huge needles
wdijkstr at arm dot com
sourceware-bugzilla@sourceware.org
Mon Sep 17 13:21:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=23637
--- Comment #4 from Wilco <wdijkstr at arm dot com> ---
(In reply to Bruno Haible from comment #1)
> A test case for strstr has been posted in
> https://sourceware.org/ml/libc-alpha/2018-09/msg00195.html .
>
> But do you also have a test case for strcasestr?
A testcase for strcasestr would be identical.(In reply to Bruno Haible from
comment #3)
> (In reply to Wilco from comment #2)
> > A testcase for strcasestr would be identical.
>
> I thought so as well. But when I transposed the strstr test case to use
> strcasestr, I found that it did not fail in glibc 2.28 in x86 mode. See
> https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00077.html
>
> Note that there are subtle differences between string/strstr.c and
> string/strcasestr.c.
It fails if I add my testcase to string/test-strcasestr.c and passes with the
fix as posted.
The initial values of haystack/haystack_len in two_way_long_needle are indeed
different between strstr and strcasestr. This means the reported testcase will
not always fail. You need a needle size of at least 1024 before it is
guaranteed to fail.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list