bug-parted
[Top][All Lists]
Advanced

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

Bug in mac_alloc


From: Alex Kiernan
Subject: Bug in mac_alloc
Date: 13 Jan 2004 09:58:36 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

The partition code in mac_alloc (in disk_mac.c) is broken over its
usage of disk->disk_specific. 

If you trace back up the call chain, disk->disk_specific isn't
initialised anywhere. If you're building DEBUG, ped_malloc happens to
initialise it to -1 (assuming 0xffffffff == -1). In the RedHat RPM
build there's a patch which causes it to be initialised to 0x00000000
(again if DEBUG, which the SPEC file will always generate), which
causes that test to fail.

The standard build "works" because disk->disk_specific will be
non-NULL, but would SEGV if ped_malloc failed. The RedHat version
fails on all mac partition tables because disk->disk_specific is
always NULL.

This patch fixes this:

--- parted-1.6.6.orig/libparted/disk_mac.c      2003-06-30 01:47:58.000000000 
+0100
+++ parted-1.6.6/libparted/disk_mac.c   2004-01-04 03:11:40.000000000 +0000
@@ -258,7 +258,7 @@
                goto error;
 
        mac_disk_data = (MacDiskData*) ped_malloc (sizeof (MacDiskData));
-       if (!disk->disk_specific)
+       if (!mac_disk_data)
                goto error_free_disk;
        disk->disk_specific = mac_disk_data;
        mac_disk_data->ghost_size = disk->dev->sector_size / 512;


-- 
Alex Kiernan, Principal Engineer, Development, THUS plc





reply via email to

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