This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use Quicksearch in strstr


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]