[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] mac: Fix crash with partition map sector size different than phy
From: |
Lubomir Rintel |
Subject: |
[PATCH] mac: Fix crash with partition map sector size different than physical one |
Date: |
Tue, 27 Sep 2011 13:49:18 +0200 |
From: Lubomir Rintel <address@hidden>
---
Output from valgrind:
==26304== Memcheck, a memory error detector
==26304== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==26304== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==26304== Command: /home/lkundrak/src/parted/parted/.libs/lt-parted
/home/lkundrak/Downloads/xcode_3.2.6_and_ios_sdk_4.3.img print all
==26304==
==26304== Warning: noted but unhandled ioctl 0x5382 with no size/direction hints
==26304== This could cause spurious value errors to appear.
==26304== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
proper wrapper.
WARNING: You are not superuser. Watch out for permissions.
Warning: Unable to open /home/lkundrak/Downloads/xcode_3.2.6_and_ios_sdk_4.3.img
read-write (Permission denied).
/home/lkundrak/Downloads/xcode_3.2.6_and_ios_sdk_4.3.img has been opened
read-only.
Warning: Unable to open /home/lkundrak/Downloads/xcode_3.2.6_and_ios_sdk_4.3.img
read-write (Permission denied).
/home/lkundrak/Downloads/xcode_3.2.6_and_ios_sdk_4.3.img has been opened
read-only.
Warning: The driver descriptor says the physical block size is 2048 bytes, but
Linux says it is 512 bytes.
Ignore/Cancel? i
==26304== Invalid write of size 4
==26304== at 0x40087D8: memcpy (mc_replace_strmem.c:628)
==26304== by 0x4022FE8: linux_read (linux.c:1740)
==26304== by 0x4016D7A: ped_device_read (device.c:331)
==26304== by 0x40390D4: mac_read (mac.c:765)
==26304== by 0x401E184: ped_disk_new (disk.c:199)
==26304== by 0x804CF25: do_print (parted.c:944)
==26304== by 0x804DCC2: _print_list (parted.c:1174)
==26304== by 0x804DC73: do_print (parted.c:980)
==26304== by 0x8051F04: non_interactive_mode (ui.c:1608)
==26304== by 0x804F670: main (parted.c:1999)
==26304== Address 0x40e39a0 is 0 bytes after a block of size 512 alloc'd
==26304== at 0x400682F: malloc (vg_replace_malloc.c:236)
==26304== by 0x4018141: ped_malloc (libparted.c:227)
==26304== by 0x403BFDF: ptt_read_sectors (pt-tools.c:67)
==26304== by 0x403C0C1: ptt_read_sector (pt-tools.c:83)
==26304== by 0x4038D45: mac_read (mac.c:739)
==26304== by 0x401E184: ped_disk_new (disk.c:199)
==26304== by 0x804CF25: do_print (parted.c:944)
==26304== by 0x804DCC2: _print_list (parted.c:1174)
==26304== by 0x804DC73: do_print (parted.c:980)
==26304== by 0x8051F04: non_interactive_mode (ui.c:1608)
==26304== by 0x804F670: main (parted.c:1999)
libparted/labels/mac.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index bd756c2..a1c6fad 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -750,6 +750,9 @@ mac_read (PedDisk* disk)
goto error;
ghost_size = mac_disk_data->ghost_size;
+ // sector_size might have changed in _disk_analyse_block_size()
+ buf = ped_malloc (disk->dev->sector_size);
+
if (!ped_disk_delete_all (disk))
goto error;
@@ -759,6 +762,7 @@ mac_read (PedDisk* disk)
mac_disk_data->driver_count = raw_disk->driver_count;
mac_disk_data->block_size = raw_disk->block_size;
}
+ free (raw_disk);
for (num=1; num==1 || num <= last_part_entry_num; num++) {
void *raw_part = buf;
--
1.7.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] mac: Fix crash with partition map sector size different than physical one,
Lubomir Rintel <=