From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Lt7JB-0005gJ-37 for mharc-grub-devel@gnu.org; Sun, 12 Apr 2009 17:33:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lt7J9-0005gE-EO for grub-devel@gnu.org; Sun, 12 Apr 2009 17:33:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lt7J4-0005g1-3X for grub-devel@gnu.org; Sun, 12 Apr 2009 17:33:42 -0400 Received: from [199.232.76.173] (port=35051 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lt7J3-0005fy-U1 for grub-devel@gnu.org; Sun, 12 Apr 2009 17:33:37 -0400 Received: from c60.cesmail.net ([216.154.195.49]:26196) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1Lt7J3-0001vI-Hu for grub-devel@gnu.org; Sun, 12 Apr 2009 17:33:37 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 12 Apr 2009 17:33:37 -0400 Received: from [192.168.0.220] (pool-141-151-93-148.phlapa.east.verizon.net [141.151.93.148]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id 8D14734C6A for ; Sun, 12 Apr 2009 17:35:05 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <49E1E2BC.3020405@gmail.com> References: <200904111919.49761.okuji@enbug.org> <20090411.044848.183598331.davem@davemloft.net> <49E0EB22.4070308@gmail.com> <20090412.010719.229891360.davem@davemloft.net> <49E1E2BC.3020405@gmail.com> Content-Type: text/plain Date: Sun, 12 Apr 2009 17:33:35 -0400 Message-Id: <1239572015.14481.32.camel@ct> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH]: grub: Fix handling of long printf arguments on 64-bit. X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2009 21:33:43 -0000 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