Re: bug with printf positional arguments?

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Jun 28 14:28, Jon Turney wrote:
> 
> The following trivial program (extracted from a glib testcase)
> 
> > #include <stdio.h>
> > 
> > int main()
> > {
> >   printf ("%1$*2$.*3$s", "abc", 5, 2);
> > }
> 
> does not produce the expected output of "   ab", on 64-bit Cygwin.
> 
> From a bit of staring at and stepping through get_args() in
> libc/stdio/vfprintf.c, it looks like the problem is (something like) we
> don't have the knowledge that the first positional variadic argument should
> be treated as a pointer, at the point that we store it's value, so it gets
> treated as an integer (the default), which is going to lead to truncation on
> LP64 platforms.
> 
> A straightforward way to fix this eludes me.

Can you point out where in the code this problem occurs, so maybe
we can discuss the necessary code changes in this thread?


Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.