bug-parted
[Top][All Lists]
Advanced

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

bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert


From: Phillip Susi
Subject: bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error
Date: Mon, 11 Apr 2016 20:21:51 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

-----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 <address@hidden>
> 
> 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 via email to

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