Sat 15 Oct 2011 12:38:30 PM UTC, comment #2:
> It is not clear what you mean:
sry, my English skill is not quite good.
>1) Do you mean that
>printf("%3$s go %1$s", "down", "es", "down team");
>produces no output, or it crashes (SIGSEGV, core dump)?
>The expected behaviour is that it produces no output.
Currently it crashes because internal code tries to memcpy(dest, NULL, size);
I think no output is even worse than SIGSEGV, which makes programmer doesn't know about what's wrong in his program.
>2) Was that printf statement in a compilation with out without
>#include <libintl.h>?
I included gettext.h so I assume it included libintl.h too.
>3) On which platform (operating system)?
Windows and Linux, didn't tested on other platforms.
>You certainly know that the format string "%3$s go %1$s" above
>is invalid: POSIX says in ...
I see. i'd better fix it with some workarounds.
>You mean, it returns NULL? That is as it should be.
vasnprintf returns NULL so other internal functions use that result into memcpy. SIGSEGV occurs.
>An omitted argument could also occupy 8 bytes on the argument >stack,
>if it's a 'double' or 'long long' argument.
>If the code makes a wrong assumption here, it is likely that
>it will dereference invalid pointers and crash. That's why
>it is better that it just returns with an error indicator.
I know 4 byte is wrong, but it was the behavior of previous versions of gettext.(at least 0.17 I tested) I hoped it works as its previous versions but w/e.
>It sets errno. That's the "exception handling functionality"
>specified by POSIX. As you know, there is no try/catch in C.
it crashes and doesn't set errno. there's no exception handling now.
|