From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 06 01:48:56 2016 Received: (at submit) by debbugs.gnu.org; 6 Mar 2016 06:48:56 +0000 Received: from localhost ([127.0.0.1]:36120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1acSUq-0001SH-0C for submit@debbugs.gnu.org; Sun, 06 Mar 2016 01:48:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36799) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1acSUo-0001S4-IG for submit@debbugs.gnu.org; Sun, 06 Mar 2016 01:48:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acSUi-0007Fn-Gi for submit@debbugs.gnu.org; Sun, 06 Mar 2016 01:48:49 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acSUi-0007Fj-D7 for submit@debbugs.gnu.org; Sun, 06 Mar 2016 01:48:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acSUh-0003tn-DI for bug-parted@gnu.org; Sun, 06 Mar 2016 01:48:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acSUe-0007FW-7s for bug-parted@gnu.org; Sun, 06 Mar 2016 01:48:47 -0500 Received: from smtpproxy19.qq.com ([184.105.206.84]:48607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acSUd-0007FQ-WB for bug-parted@gnu.org; Sun, 06 Mar 2016 01:48:44 -0500 X-QQ-mid: Xesmtp15t1457246916t590t1684 Received: from lx-pc (unknown [14.204.32.133]) by esmtp5.qq.com (ESMTP) with id ; Sun, 06 Mar 2016 14:48:35 +0800 (CST) X-QQ-SSF: B1000000000000F0FF113000000000Z X-QQ-FEAT: lXZwLChBY8tAU0P2en6Gg7Ji1A2UO/JapMxEBDfYZSzWjawFtH2gyrHbz5Bev q1rdGD+KIOxbfYaaPNoAJzS2ZRiRVrCUBbt6AUmgqLEkk7pyoyyma33rIcpnr5aTisIB0+9 Y9lkVZb3StYgOQbb4aLth0fjPi3w1NYYv65WSSOQCA/xUHjVTdlCDD6kq53WqvXq5IGoy1C 1uffZmQjLCtSZVrj3TJ465c5hLdgfKZ7IYIdL95VRwt1djT0fdWMc X-QQ-GoodBg: 0 From: lu4nx To: bug-parted@gnu.org Subject: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error Date: Sun, 6 Mar 2016 14:48:27 +0800 Message-Id: <1457246907-13060-1-git-send-email-lx@shellcodes.org> X-Mailer: git-send-email 2.5.0 X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: Xi Lu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) From: Xi Lu 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 From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 11 20:21:59 2016 Received: (at 22920) by debbugs.gnu.org; 12 Apr 2016 00:21:59 +0000 Received: from localhost ([127.0.0.1]:59855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apm5f-0001Q6-Eq for submit@debbugs.gnu.org; Mon, 11 Apr 2016 20:21:59 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.227]:56460 helo=cdptpa-oedge-vip.email.rr.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apm5d-0001Ps-BT for 22920@debbugs.gnu.org; Mon, 11 Apr 2016 20:21:57 -0400 Received: from [72.239.162.168] ([72.239.162.168:59858] helo=[192.168.1.142]) by cdptpa-oedge01 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 53/FA-30134-F9F3C075; Tue, 12 Apr 2016 00:21:51 +0000 Subject: Re: bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error To: lu4nx , 22920@debbugs.gnu.org References: <1457246907-13060-1-git-send-email-lx@shellcodes.org> From: Phillip Susi Message-ID: <570C3F9F.6030305@ubuntu.com> 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 MIME-Version: 1.0 In-Reply-To: <1457246907-13060-1-git-send-email-lx@shellcodes.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.118:25 X-Cloudmark-Score: 0 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22920 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) -----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 > > 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----- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 14 21:02:43 2016 Received: (at 22920-done) by debbugs.gnu.org; 15 Apr 2016 01:02:43 +0000 Received: from localhost ([127.0.0.1]:35858 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqs9j-0007C8-Lv for submit@debbugs.gnu.org; Thu, 14 Apr 2016 21:02:43 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.230]:41729 helo=cdptpa-oedge-vip.email.rr.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqs9j-0007Bv-3k for 22920-done@debbugs.gnu.org; Thu, 14 Apr 2016 21:02:43 -0400 Received: from [72.239.162.168] ([72.239.162.168:37654] helo=[192.168.1.142]) by cdptpa-oedge03 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id F5/62-20905-DAD30175; Fri, 15 Apr 2016 01:02:37 +0000 Subject: Re: bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error To: 22920-done@debbugs.gnu.org References: <1457246907-13060-1-git-send-email-lx@shellcodes.org> From: Phillip Susi Message-ID: <57103DAD.2070806@ubuntu.com> 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 MIME-Version: 1.0 In-Reply-To: <1457246907-13060-1-git-send-email-lx@shellcodes.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22920-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 It seems this was already fixed: commit f5c628dd51c7d77ff939554425159ab6e8aef1c0 Author: Brian C. Lane 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----- From unknown Mon Aug 18 04:42:11 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 13 May 2016 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator