This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] vectorized string functions
- From: Rich Felker <dalias at aerifal dot cx>
- To: libc-alpha at sourceware dot org
- Date: Wed, 11 Jul 2012 03:46:55 -0400
- Subject: Re: [PATCH] vectorized string functions
- References: <20120711151007.GA3468@domone.rutgers.edu>
On Wed, Jul 11, 2012 at 05:10:07PM +0200, OndÅej BÃlka wrote:
> Now I am almost done with vectorized implementation of string functions.
> I use single loop to get faster implementation of *len, *chr and *str
> functions.
In light of the recent strstr breakage issue (quadratic performance),
I looked at your strstr implementation. I noticed some MAJOR bugs
before I even got to looking at the algorithm (which I still haven't
done). The biggest is that you're storing the result of strlen
(size_t) into int, i.e. truncating the length to 32 bits. There are
also integer overflow issues (I saw unchecked 8*ns where ns is the
truncated string length).
In any case, before this code has any chance of being adopted, it's
going to require a major security/safety audit. The above kinds of
mistakes, well, don't inspire confidence...
Rich