This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Jan 9 14:50, Ivan Grokhotkov wrote: > Hi, > In newlib builds with multibyte support disabled and positional arguments support enabled, positional arguments sometimes are not printed correctly. For example, > > printf(“%1$f”, 1.0); > > may print garbage value on a 32-bit platform. > > This issue happens because the code path in get_arg, which looks for ‘%’ character, does not work correctly for the ! _MB_CAPABLE case. In _MB_CAPABLE case, fmt pointer is advanced to the next character, and then the check for ‘%’ is performed. In !_MB_CAPABLE case, the check is performed before advancing ‘fmt’ pointer. Net result is that in !_MB_CAPABLE case fmt still points to ‘%’ character, which causes the subsequent state machine to go from START to DONE state immediately. ‘spec_type’ defaults to INT, so arguments which are longer than int (for example, double) are not fetched correctly using va_arg. > > Patch is attached. > > Thanks, > Ivan Pushed. Thanks, Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat
Attachment:
signature.asc
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |