[PATCH] Use Quicksearch in strstr
Joseph Myers
joseph@codesourcery.com
Tue Nov 6 17:50:00 GMT 2018
On Tue, 6 Nov 2018, Rich Felker wrote:
> Real world performance includes performance under the control of a
> hostile input source, under which naive algorithms will perform
> hundreds of times slower. This "quicksearch" is incredibly slow on
Indeed. I think strstr failing to be O(m+n) worst case is clearly a
security bug; when you have an upper bound on m for an O(mn) algorithm to
avoid a quadratic worst case, the only question is at what point that
bound gets too high so the worst case performance is excessively bad.
I've just filed bug 23865 for wcsstr using a naive quadratic-time
implementation.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list