GNU bug report logs -
#22920
[PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error
Previous Next
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.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error
which was filed against the parted package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 22920 <at> debbugs.gnu.org.
--
22920: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22920
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
-----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-----
[Message part 3 (message/rfc822, inline)]
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
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.