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]

printf field width argument handling


Hi,


better don't try this on your machine:

  printf ("%*********s", 6, "abc");

It's an almost sure way to let the CPU run away.  Yes, it's a malformed
format string.  But still, instead of bailing out early, every single
'*' will result in reading the next argument from the argument list to
fetch the field width.  The same occurs for precision specifiers.

It does not occur in glibc, though.  So my question is this.  Shouldn't
we avoid to do that and stop converting further arguments into width and
precision values after the first '*' has been handled?  And if so, what
would be the most useful error reaction?


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]