bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strstr


From: Eric Blake
Subject: Re: strstr
Date: Wed, 17 Jun 2009 05:54:49 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 6/17/2009 2:17 AM:
> Eric Blake wrote:
>> Hmm.  I'm now starting to wonder whether I should create a new module
>> strstr-simple, which fixes broken strstr (in the presence of broken
>> memchr) but without worrying about quadratic vs. linear (similar to
>> strcasestr-simple which only worries about providing strcasestr on
>> platforms that lack it, compared to strcasestr which worries about speed).
> 
> Would make sense, for consistency with 'strcasestr'.

OK, I'll work on that then.

>> I still think it would be interesting to get my hands on one of the
>> machines like in the Debian report, so that I could also test whether
>> printf("%.*s",...) segfaults on an appropriately fenced string.
> 
> It won't segfault: The use of memchr in vasnprintf.c is guarded by
>   #if !USE_SNPRINTF && !HAVE_STRNLEN
> and on glibc platforms, both USE_SNPRINTF and HAVE_STRNLEN are defined to 1.

The gnulib replacement won't segfault.  And inspection of the glibc
version of printf shows that it uses strnlen, not memchr, so that looks
safe too.

Also, I just noticed that another glibc memchr fix went in for x86_64 just
yesterday:
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fab823

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko42YkACgkQ84KuGfSFAYD9wQCg1VlJMunnViLgTIlA50UTbonH
h+QAn0x8h/0gJECFXzvGcu/Yuyg8IzZi
=FxiM
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]