All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <weil@mail.berlios.de>
To: Herve Poussineau <hpoussin@reactos.org>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] Re: [PATCH] win32: use PRId64 instead of %lld
Date: Mon, 25 Jan 2010 20:41:09 +0100	[thread overview]
Message-ID: <4B5DF3D5.5080101@mail.berlios.de> (raw)
In-Reply-To: <4B5DD596.4040503@mail.berlios.de>

Stefan Weil schrieb:
> Michael S. Tsirkin schrieb:
>> On Sun, Jan 24, 2010 at 09:23:41PM +0000, Herve Poussineau wrote:
>>> Replace %lld occurrences by PRId64.
>> This is wrong.
>> long long values should be printed with %lld.
>> size_t - with %zd. PRId64 is for int64_t.
>>
>
> size_t => %zu, ssize_t => %zd might be better.
>
> And none of them works on win32, so using them
> there can result in a crash:
>
> size_t st = 4711;
> fprintf(stderr, "st=%zu, %s\n", st, "test");
>
> printf functions on win32 don't know %z.
> They run
>
> fprintf(stderr, "st=zu, %s\n", st, "test");
>
> which results in an memory access fault when printf
> wants to read the memory at address 0x4711.
>
> Regards,
> Stefan Weil
>
>

Hi,

I just read this which could explain crashes with %lld:

/* MSVCRT supports additional length specifiers for "printf". (In
fact, it does not support some of the C99 specifiers, like
"ll". However, we do not presently have a mechanism for disabling
a specifier.) */

A short test:
    long long ll = 0;
    printf("ll=%lld, string=%s\n", ll, "test");

ll=0, string=(null)

=> You can crash QEMU for win32 with %lld.

Regards,
Stefan

  parent reply	other threads:[~2010-01-25 19:41 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-24 21:23 [Qemu-devel] [PATCH] win32: use PRId64 instead of %lld Herve Poussineau
2010-01-25 10:09 ` [Qemu-devel] " Michael S. Tsirkin
2010-01-25 14:03   ` Luiz Capitulino
2010-01-25 14:35     ` Markus Armbruster
2010-01-25 15:27       ` Luiz Capitulino
2010-01-25 15:38         ` Michael S. Tsirkin
2010-01-26 11:43           ` Luiz Capitulino
2010-01-26 12:37             ` Markus Armbruster
2010-01-26 12:56               ` Anthony Liguori
2010-01-26 12:56                 ` Michael S. Tsirkin
2010-01-26 13:05                   ` Anthony Liguori
2010-01-26 13:12                     ` Michael S. Tsirkin
2010-01-26 12:47             ` Anthony Liguori
2010-01-26 12:46               ` Michael S. Tsirkin
2010-01-26 12:58                 ` Anthony Liguori
2010-01-26 13:01                   ` Michael S. Tsirkin
2010-01-26 13:13                     ` Anthony Liguori
2010-01-26 13:08                   ` Daniel P. Berrange
2010-01-26 13:15                     ` Anthony Liguori
2010-01-26 13:55               ` Avi Kivity
2010-01-26 14:05                 ` Anthony Liguori
2010-01-26 14:12                   ` Avi Kivity
2010-01-26 14:38                     ` Anthony Liguori
2010-01-25 17:32   ` Stefan Weil
2010-01-25 17:47     ` Michael S. Tsirkin
2010-01-25 19:23       ` Stefan Weil
2010-01-25 19:32         ` Michael S. Tsirkin
2010-01-25 19:34           ` Michael S. Tsirkin
2010-01-25 19:51       ` Daniel P. Berrange
2010-01-25 19:41     ` Stefan Weil [this message]
2010-01-26 22:40 ` [Qemu-devel] " Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B5DF3D5.5080101@mail.berlios.de \
    --to=weil@mail.berlios.de \
    --cc=hpoussin@reactos.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.