1
From a0ab2a3618604db9ecca922c103ed61dd81eb162 Mon Sep 17 00:00:00 2001
2
From: "Brian C. Lane" <bcl@redhat.com>
3
Date: Fri, 28 Mar 2014 17:10:18 +0000
4
Subject: HFS/HFS+ probe: don't let a corrupt FS evoke failed assertion
6
Origin: upstream, http://git.debian.org/?p=parted/parted.git;a=commitdiff;h=6bc7e1965078579e9855f851254d67b3d8165784
7
Bug-Fedora: http://bugzilla.redhat.com/714758
8
Bug-Ubuntu: https://bugs.launchpad.net/bugs/796891
10
Last-Update: 2012-03-20
12
Patch-Name: hfs-probe-corrupt.patch
14
libparted/fs/hfs/probe.c | 18 +++++++++++-------
15
1 file changed, 11 insertions(+), 7 deletions(-)
17
diff --git a/libparted/fs/hfs/probe.c b/libparted/fs/hfs/probe.c
18
index e56fef9..6fab79e 100644
19
--- a/libparted/fs/hfs/probe.c
20
+++ b/libparted/fs/hfs/probe.c
21
@@ -83,7 +83,8 @@ hfs_and_wrapper_probe (PedGeometry* geom)
22
+ ((PedSector) PED_BE16_TO_CPU (mdb->total_blocks)
23
* (PED_BE32_TO_CPU (mdb->block_size) / PED_SECTOR_SIZE_DEFAULT )));
24
max = search + (PED_BE32_TO_CPU (mdb->block_size) / PED_SECTOR_SIZE_DEFAULT);
25
- if (!(geom_ret = ped_geometry_new (geom->dev, geom->start, search + 2)))
27
+ || !(geom_ret = ped_geometry_new (geom->dev, geom->start, search + 2)))
30
for (; search < max; search++) {
31
@@ -142,8 +143,9 @@ hfsplus_probe (PedGeometry* geom)
33
search = max - 2 * ( PED_BE32_TO_CPU (vh->block_size)
34
/ PED_SECTOR_SIZE_DEFAULT ) + 2;
35
- if (!(geom_ret = ped_geometry_new (geom->dev, geom->start,
38
+ || !(geom_ret = ped_geometry_new (geom->dev, geom->start,
42
for (; search < max; search++) {
43
@@ -157,8 +159,9 @@ hfsplus_probe (PedGeometry* geom)
44
search = ((PedSector) PED_BE32_TO_CPU (vh->total_blocks) - 1)
45
* ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT )
47
- if (!ped_geometry_set (geom_ret, geom_ret->start,
50
+ || !ped_geometry_set (geom_ret, geom_ret->start,
52
|| !ped_geometry_read (geom_ret, buf, search, 1)
53
|| vh->signature != PED_CPU_TO_BE16 (HFSP_SIGNATURE)) {
54
ped_geometry_destroy (geom_ret);
55
@@ -214,8 +217,9 @@ hfsx_probe (PedGeometry* geom)
56
* ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT )
58
search = max - ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT );
59
- if (!(geom_ret = ped_geometry_new (geom->dev, geom->start,
62
+ || !(geom_ret = ped_geometry_new (geom->dev, geom->start,
65
for (; search < max; search++) {
66
if (!ped_geometry_set (geom_ret, geom_ret->start,