Skip to content
Commit 0e253fa2 authored by Mike Fleetwood's avatar Mike Fleetwood
Browse files

Prevent crash when creating new partition on loop label (#721988)

Write a loop partition table to a disk and then try to create a new
partition on that disk crashes GParted.

Analysis:

1) Loop partition table, actually just the signature / label
   "GNU Parted Loopback 0", is written to the disk.
2) create_partition() calls ped_disk_app_partition() to create the
   partition which, arguably erroneously, clears the loop signature.
3) In erase_filesystem_signatures(), get_device_and_disk() fails because
   there's no longer a loop signature for libparted to recognise.  This
   leaves lp_device, lp_disk and lp_partition = NULL, but incorrectly
   overall_success = true.
4) Overall_success = true allows the signature erasure loop to run and
   evaluate lp_device->sector_size, dereferencing a NULL pointer and
   crashing GParted.

Fix erase_filesystem_signatures() to correctly handle failure from
get_device_and_disk(), broken by this commit:

    246e0555
    Clear btrfs file system super block mirror copies too (#705426)

Bug #721988 - Crash when creating new partition on disk with loop label
parent f439a31a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment