GNU bug report logs - #22920
[PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error

Previous Next

Package: parted;

Reported by: lu4nx <lx <at> shellcodes.org>

Date: Sun, 6 Mar 2016 06:49:02 UTC

Severity: normal

Tags: patch

Done: Phillip Susi <psusi <at> ubuntu.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22920 in the body.
You can then email your comments to 22920 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-parted <at> gnu.org:
bug#22920; Package parted. (Sun, 06 Mar 2016 06:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to lu4nx <lx <at> shellcodes.org>:
New bug report received and forwarded. Copy sent to bug-parted <at> gnu.org. (Sun, 06 Mar 2016 06:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: lu4nx <lx <at> shellcodes.org>
To: bug-parted <at> gnu.org
Cc: Xi Lu <lx <at> shellcodes.org>
Subject: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error
Date: Sun,  6 Mar 2016 14:48:27 +0800
From: Xi Lu <lx <at> shellcodes.org>

if forget create a partition, and execute:

`name 1 grub`

ped_disk_get_partition() will trigger an exception:

  Assertion (disk != NULL)
---
 libparted/disk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libparted/disk.c b/libparted/disk.c
index fe82f44..9f36d10 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -1594,7 +1594,10 @@ ped_disk_get_partition (const PedDisk* disk, int num)
 {
 	PedPartition*	walk;
 
-	PED_ASSERT (disk != NULL);
+        if (disk == NULL) {
+          fprintf(stderr, "you must specify partition.");
+          return NULL;
+        }
 
 	for (walk = disk->part_list; walk;
 	     walk = ped_disk_next_partition (disk, walk)) {
-- 
2.5.0







Information forwarded to bug-parted <at> gnu.org:
bug#22920; Package parted. (Tue, 12 Apr 2016 00:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 22920 <at> debbugs.gnu.org (full text, mbox):

From: Phillip Susi <psusi <at> ubuntu.com>
To: lu4nx <lx <at> shellcodes.org>, 22920 <at> debbugs.gnu.org
Subject: Re: bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix
 assert error
Date: Mon, 11 Apr 2016 20:21:51 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

The patch is not correct because as a library, libparted can not
simply write directly to stderr; it must throw an exception instead.
In all probability the bug lies in parted itself, which should not be
calling ped_disk_get_partition on a NULL disk pointer.  I'll work on a
proper fix for this.

On 03/06/2016 01:48 AM, lu4nx wrote:
> From: Xi Lu <lx <at> shellcodes.org>
> 
> if forget create a partition, and execute:
> 
> `name 1 grub`
> 
> ped_disk_get_partition() will trigger an exception:
> 
> Assertion (disk != NULL) --- libparted/disk.c | 5 ++++- 1 file
> changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libparted/disk.c b/libparted/disk.c index
> fe82f44..9f36d10 100644 --- a/libparted/disk.c +++
> b/libparted/disk.c @@ -1594,7 +1594,10 @@ ped_disk_get_partition
> (const PedDisk* disk, int num) { PedPartition*	walk;
> 
> -	PED_ASSERT (disk != NULL); +        if (disk == NULL) { +
> fprintf(stderr, "you must specify partition."); +          return
> NULL; +        }
> 
> for (walk = disk->part_list; walk; walk = ped_disk_next_partition
> (disk, walk)) {
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCgAGBQJXDD+fAAoJEBB5UWFcu6UWwmMIAIMSpnrhXNljGeUZ/gccM2MA
bA/48aAhuz99itHJ1sNAMFeFY8eTI48k4/uLGVidvsIuFqRaNuEMjkNip43bpaVP
yjEyX8/iqr4a6D3EtokCVXMmoWFXzte+xTNV90h1rELEACYQLhlAA8sx01TQdGz2
0XNPR2ww4LaPFb01UsgDfval8XLQrrpnIypEyJtTYxYnmlRZXDK2I9yGivncE8eT
lNCTNjMBGSVDwa5aBp7ys5goLdHb3v4ilt3OUlA4DZBPUV3gJSXd06MgEBxgJHvu
+xqnfS6bmf9qzZgHtgNfdyhfdBxT4QjqDzUpFWFr75ld+tRqDRHcKu0n9xaqV/s=
=DWyu
-----END PGP SIGNATURE-----




Reply sent to Phillip Susi <psusi <at> ubuntu.com>:
You have taken responsibility. (Fri, 15 Apr 2016 01:03:02 GMT) Full text and rfc822 format available.

Notification sent to lu4nx <lx <at> shellcodes.org>:
bug acknowledged by developer. (Fri, 15 Apr 2016 01:03:02 GMT) Full text and rfc822 format available.

Message #13 received at 22920-done <at> debbugs.gnu.org (full text, mbox):

From: Phillip Susi <psusi <at> ubuntu.com>
To: 22920-done <at> debbugs.gnu.org
Subject: Re: bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix
 assert error
Date: Thu, 14 Apr 2016 21:02:37 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

It seems this was already fixed:

 commit f5c628dd51c7d77ff939554425159ab6e8aef1c0
 Author: Brian C. Lane <bcl <at> redhat.com>
 Date:   Mon Jul 13 16:43:11 2015 -0700

     parted: Fix crash with name command and no disklabel (#1226067)

     A typo (the last I think) from commit 7eac058 wasn't properly
checking
     the result of ped_disk_new so it could crash if there was no
disklabel
     on the device.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCgAGBQJXED2tAAoJEBB5UWFcu6UWw7YH/23Dl08RpAfcRiFmEYVbzkae
ZHLEDUOuebwhB9CQ5lCzzdE0tneXPg3z8LHYaQTxmmS3lqeZCKpcrmuNK0UHRGxU
iAC42Lou36nVThRFlaE4kY0soFevPiLj3+qIYrVtG9jLc8eZQQipwA4779/FQ4u3
6Pnvkr2Oj6zH8+U5L7Y+AGBcjBZlxCmQzA0vfrNjoe2FYC7QY+4gnriT215J/auX
OUPcj8wH0GK7YimT48e5aKeheIZbPHKN18J5t9wsg0k6LaWsj427uxsXQugTHVZj
iLI6qYBSjMWKX80Qd1ceXBkKtSGep7UalIfpWHk94rs7H+SutFpWV4wXQcu0w4s=
=mxV9
-----END PGP SIGNATURE-----




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 May 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 98 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.