grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH]: grub: Fix handling of long printf arguments on 64-bit.


From: Pavel Roskin
Subject: Re: [PATCH]: grub: Fix handling of long printf arguments on 64-bit.
Date: Sun, 12 Apr 2009 17:33:35 -0400

On Sun, 2009-04-12 at 14:46 +0200, phcoder wrote:
> -                 grub_itoa (tmp, c, n);
> +                 grub_lltoa (tmp, c, n);

Wrong.  For "x" and "u" specifiers, the value is unsigned int, but n is
signed int.  If we extend signed into to unsigned long long, we get a
sign extension that would be incorrect.

Suppose the argument is 0xffffffff.  n would be -1.  grub_lltoa() would
get (unsigned long long)-1, that is 0xffffffffffffffff.

If the type is going to be converted, we need to treat signed and
unsigned values separately.

-- 
Regards,
Pavel Roskin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]