This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Use Quicksearch in strstr
On Tue, 6 Nov 2018, Rich Felker wrote:
>
> > >> > Calling blatant undefined behavior "a theoretical issue" is not
> > >> > something we should be doing in 2018.
> > >>
> > >> It's 100% theoretical - or you can show an example that could fail?
> > >
> > > With UBSan and LTO it should trap and abort.
> >
> > I mean a real-world failure on an actual supported target, not something
> > that's not actually possible.
>
> This is a real-world near-future target, and introducing gratuitous
> breakage for it now is utterly backwards, especially when it's so easy
> to avoid (skipping the -- ahead of time and just adding a -1 to each
> []).
A simpler fix is available: 'hs++, hs_len--' after the initial optimistic
memcmp has failed.
Alexander