Eric Blake <[EMAIL PROTECTED]> writes: > According to Simon Josefsson on 1/9/2008 3:16 AM: > | > | For gnutls, the strings are always the same (X.509 PEM headers), and we > | haven't seen such slowdowns even on large inputs (searching for a 10 > | byte needle in a 500kb input is, while not typical, not uncommon). What > | properties do unlucky strings have? > > The quadratic nature of the brute force algorithm (which glibc currently ..
Thanks for the explanation. > So I'm okay with the idea of adding a memmem-simple module that skips the > quadratic check if the system memmem is otherwise working Sounds like a plan, then. I'll see if I can produce a patch. > (remember, however, that the system memmem may be broken, as on > cygwin). Did the old check find that brokenness? Has this brokenness been discussed before, and was a m4 test to detect it produced? I can't see anything in memmem.m4 about it now. > But I think it should be done solely through m4 magic - in other > words, split gl_FUNC_MEMMEM into two macros, where the behavioral > check is called for both memmem and memmem-simple, but the speed check > is called only for memmem; both modules can share the lib/memmem.c > implementation. Sure. /Simon