This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Fix strstr bug with huge needles (bug 23637)
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- Cc: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, nd <nd at arm dot com>
- Date: Wed, 12 Sep 2018 06:22:46 -0700
- Subject: Re: [PATCH] Fix strstr bug with huge needles (bug 23637)
- References: <HE1PR08MB1035D7762652D7DA405A25AF831B0@HE1PR08MB1035.eurprd08.prod.outlook.com>
On Wed, Sep 12, 2018 at 6:01 AM, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
> As reported in https://sourceware.org/ml/libc-help/2018-09/msg00000.html ,
> the generic strstr in GLIBC 2.28 fails to match huge needles. The optimized
> AVAILABLE macro reads ahead a large fixed amount to reduce the overhead of
> repeatedly checking for the end of the string. However if the needle length
> is larger than this, two_way_long_needle may confuse this as meaning the end
> of the string and return NULL. This is fixed by adding the needle length to
> the amount to read ahead.
> Passes GLIBC regress on AArch64, new testcase now passes.
> 2018-06-30 Wilco Dijkstra <firstname.lastname@example.org>
> [BZ #21286]
> * string/Makefile: Add bug-strstr1.
> * string/bug-strstr1.c: New test.
Please add the new test to test-strstr.c so that all implementations
will be tested.