[PATCH] Fix strstr bug with huge needles (bug 23637)
H.J. Lu
hjl.tools@gmail.com
Wed Sep 12 13:22:00 GMT 2018
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.
>
> ChangeLog:
> 2018-06-30 Wilco Dijkstra <wdijkstr@arm.com>
>
> [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.
--
H.J.
More information about the Libc-alpha
mailing list