From 1d851a98d373ac80d50c3c139a24b1da378307e030defb0a042a442457254cde Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Fri, 30 Dec 2011 08:47:40 +0000 Subject: [PATCH] - fix crash in nilfs2 probe function if there is tiny (1s) partition on the disk (bnc#735763) - fix-nilfs2-probe-function.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=60 --- fix-nilfs2-probe-function.patch | 38 +++++++++++++++++++++++++++++++++ parted.changes | 7 ++++++ parted.spec | 16 ++++++-------- 3 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 fix-nilfs2-probe-function.patch diff --git a/fix-nilfs2-probe-function.patch b/fix-nilfs2-probe-function.patch new file mode 100644 index 0000000..47e99ef --- /dev/null +++ b/fix-nilfs2-probe-function.patch @@ -0,0 +1,38 @@ +From 2147402b83b27a35011cad032d0519c4a0672280 Mon Sep 17 00:00:00 2001 +From: Jim Meyering +Date: Sat, 25 Jun 2011 08:49:58 +0200 +Subject: [PATCH] libparted: fix a bug in the nilfs2 probe function + +* libparted/fs/nilfs2/nilfs2.c (nilfs2_probe): Reject this partition +if we get a negative sb2 offset. Passing a negative offset to +ped_geometry_read_alloc would evoke a failed assertion. +Bug introduced by 2010-07-09 commit d463e7de. +* NEWS: (Bug fixes): Mention it. +Reported by Daniel Fandrich in +http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10466/focus=10472 +--- + NEWS | 3 +++ + libparted/fs/nilfs2/nilfs2.c | 5 +++-- + 2 files changed, 6 insertions(+), 2 deletions(-) + +Index: parted-2.4/libparted/fs/nilfs2/nilfs2.c +=================================================================== +--- parted-2.4.orig/libparted/fs/nilfs2/nilfs2.c ++++ parted-2.4/libparted/fs/nilfs2/nilfs2.c +@@ -108,13 +108,14 @@ nilfs2_probe (PedGeometry* geom) + struct nilfs2_super_block *sb = NULL; + struct nilfs2_super_block *sb2 = NULL; + PedSector length = geom->length; +- PedSector sb2off; + + /* ignore if sector size is not 512bytes for now */ + if (geom->dev->sector_size != PED_SECTOR_SIZE_DEFAULT) + return NULL; + +- sb2off = NILFS_SB2_OFFSET(length); ++ PedSector sb2off = NILFS_SB2_OFFSET(length); ++ if (sb2off <= 2) ++ return NULL; + + if (ped_geometry_read_alloc(geom, &sb_v, 2, 1)) + sb = sb_v; diff --git a/parted.changes b/parted.changes index 1151194..17e7900 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Dec 30 08:42:23 UTC 2011 - puzel@suse.com + +- fix crash in nilfs2 probe function if there is tiny (1s) + partition on the disk (bnc#735763) + - fix-nilfs2-probe-function.patch + ------------------------------------------------------------------- Sun Nov 20 06:27:06 UTC 2011 - coolo@suse.com diff --git a/parted.spec b/parted.spec index 4d97673..b5d19ba 100644 --- a/parted.spec +++ b/parted.spec @@ -15,15 +15,13 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - - Name: parted Version: 2.4 -Release: 15 -License: GPL-3.0+ +Release: 0 Summary: GNU partitioner -Url: http://www.gnu.org/software/parted/ +License: GPL-3.0+ Group: System/Filesystems +Url: http://www.gnu.org/software/parted/ Source0: %{name}-%{version}.tar.bz2 Source1: baselibs.conf Patch0: always-resize-part.dif @@ -43,6 +41,7 @@ Patch13: parted-2.4-ncursesw6.patch Patch14: parted-gpt-sync-mbr-label.patch Patch15: parted-use-ext-range.patch Patch16: parted-improve-loop-support.patch +Patch17: fix-nilfs2-probe-function.patch Requires: /sbin/udevadm BuildRequires: check-devel BuildRequires: device-mapper-devel >= 1.02.33 @@ -51,8 +50,9 @@ BuildRequires: libblkid-devel >= 2.17 BuildRequires: libreiserfs-devel BuildRequires: libselinux-devel BuildRequires: libsepol-devel +BuildRequires: libtool BuildRequires: libuuid-devel -BuildRequires: libtool pkg-config +BuildRequires: pkg-config BuildRequires: readline-devel PreReq: %install_info_prereq BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -66,17 +66,14 @@ GNU Parted is a program for creating, destroying, resizing, checking, and copying partitions, and the file systems on them. %package -n libparted0 -License: GPL-3.0+ Summary: Library for manipulating partitions Group: System/Filesystems -AutoReqProv: on %description -n libparted0 Libparted is a library for creating, destroying, resizing, checking and copying partitions and the file systems on them. %package devel -License: GPL-3.0+ Summary: Parted Include Files and Libraries necessary for Development Group: Development/Libraries/C and C++ Requires: device-mapper-devel >= 1.02.33 @@ -109,6 +106,7 @@ to develop applications that require these. %patch14 -p1 %patch15 -p1 %patch16 -p1 +%patch17 -p1 %build export CFLAGS="%{optflags} `ncursesw6-config --cflags`"