--- Begin Message ---
Subject: |
[PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error |
Date: |
Sun, 6 Mar 2016 14:48:27 +0800 |
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)) {
--
2.5.0
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error |
Date: |
Thu, 14 Apr 2016 21:02:37 -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
It seems this was already fixed:
commit f5c628dd51c7d77ff939554425159ab6e8aef1c0
Author: Brian C. Lane <address@hidden>
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-----
--- End Message ---