[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: another vasnprintf fix
From: |
Eric Blake |
Subject: |
Re: another vasnprintf fix |
Date: |
Sat, 17 Mar 2007 20:49:01 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Bruno Haible on 3/17/2007 6:32 PM:
> * lib/vasnprintf.c (EOVERFLOW): New fallback definition.
> (VASNPRINTF): Fail with EOVERFLOW when the given allocated size is
> larger than INT_MAX, or when it grow to a value larger than INT_MAX.
This seems awkward to me. I agree that if vasnprintf inherits an INT_MAX
limit because it internally uses another *printf function with an INT_MAX
limit, then it should not loop endlessly. But since vasnprintf has the
nice API property that, unlike all other *printf functions, it does not
return an int, it should not need to be limited by INT_MAX; otherwise you
are introducing an artificial limitation which goes against the GNU
philosophy. Particularly on platforms where size_t is 64 bits, but int is
32 bits, I think it would be nice to have a *printf function that can
handle a chunk of memory larger than 2 gigabytes.
> * lib/vsprintf.c (vsprintf): Don't pass a size > INT_MAX to vasnprintf.
> * lib/sprintf.c (sprintf): Likewise.
This part I agree with.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF/Kid84KuGfSFAYARAgpNAKDN4Qgm4vU2JL2F9GeN58I9Dr4IpACgvgjA
pHCKtxuOcmPc86TJzpFwihI=
=40ew
-----END PGP SIGNATURE-----
- Re: another vasnprintf fix,
Eric Blake <=