[PATCH] Use Quicksearch in strstr

Alexander Monakov amonakov@ispras.ru
Tue Nov 6 19:42:00 GMT 2018


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



More information about the Libc-alpha mailing list