vfprintf typing problem

David Miller davem@davemloft.net
Thu Mar 29 21:21:00 GMT 2012


From: Roland McGrath <roland@hack.frob.com>
Date: Thu, 29 Mar 2012 09:53:42 -0700 (PDT)

> Ok, that is rather indirect but seems to say that any situation in which
> the total output requested would exceed INT_MAX chars should be diagnosed
> with EOVERFLOW.  At least for snprintf, anyway.  We don't really seem to
> diagnose that case as such.  Instead we have various checks that individual
> pieces of the format aren't going to overflow size_t, and those are
> diagnosed with ERANGE.  And the standard still doesn't really say anything
> about fprintf, only snprintf.  It seems to be quite a mess.

The done_add() macro Ulrich added when he fixed the bug in question
was meant to address this, don't be so focued on those (size_t) -1
tests :-)

Take a look at Ulrich's commit that added bug22.c and modified
vfprintf.c




More information about the Libc-alpha mailing list