Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Maehs-0005LC-Pf for mharc-grub-devel@gnu.org; Mon, 10 Aug 2009 19:55:12 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Maehr-0005Kt-Na for grub-devel@gnu.org; Mon, 10 Aug 2009 19:55:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Maehn-0005J4-4l for grub-devel@gnu.org; Mon, 10 Aug 2009 19:55:11 -0400 Received: from [199.232.76.173] (port=35232 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Maehm-0005Iz-QT for grub-devel@gnu.org; Mon, 10 Aug 2009 19:55:06 -0400 Received: from smarthost03.mail.zen.net.uk ([212.23.3.142]:34653) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Maehm-0007UK-8w for grub-devel@gnu.org; Mon, 10 Aug 2009 19:55:06 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost03.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1Maehj-0006Lb-PG for grub-devel@gnu.org; Mon, 10 Aug 2009 23:55:05 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1Maehd-0007do-00; Tue, 11 Aug 2009 00:54:57 +0100 Date: Tue, 11 Aug 2009 00:54:57 +0100 From: Colin Watson To: The development of GRUB 2 Message-ID: <20090810235457.GH11691@riva.ucam.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost03-IP: [82.69.40.219] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: HFS endianness 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: Mon, 10 Aug 2009 23:55:12 -0000 On Tue, Aug 11, 2009 at 01:15:54AM +0200, Vladimir 'phcoder' Serbinenko wrote: > Hello I was looking which FS were little and which are big-endian. > This attracted my attention in hfs.c: > /* Adjust len so it we can't read past the end of the file. */ > if (len > grub_le_to_cpu32 (data->size)) > len = grub_le_to_cpu32 (data->size); > Which looks suspicious for big-endian FS. Can anyone check? If note > this mail will be note to self data->size is initialised using grub_be_to_cpu32 (frec.size) in grub_hfs_open. It looks fairly clearly incorrect for it to be converted again; AFAICS that code will only work properly on little-endian CPUs. This looks as if it ought to be better, although I'm not really in a position to test it: if (len > data->size) len = data->size; -- Colin Watson [cjwatson@ubuntu.com]