Blame 0008-part-Fix-segfault-when-adding-a-partition-too-big-fo.patch

Vojtech Trefny f31a02
From 9c96e621e9abb0649118d2e1731a09b1fa139579 Mon Sep 17 00:00:00 2001
Vojtech Trefny f31a02
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny f31a02
Date: Wed, 19 Apr 2023 09:50:38 +0200
Vojtech Trefny f31a02
Subject: [PATCH] part: Fix segfault when adding a partition too big for MSDOS
Vojtech Trefny f31a02
Vojtech Trefny f31a02
Resolves: rhbz#2185564
Vojtech Trefny f31a02
---
Vojtech Trefny f31a02
 src/plugins/part.c | 8 ++++++++
Vojtech Trefny f31a02
 1 file changed, 8 insertions(+)
Vojtech Trefny f31a02
Vojtech Trefny f31a02
diff --git a/src/plugins/part.c b/src/plugins/part.c
Vojtech Trefny f31a02
index 8b2285f5..28e20c28 100644
Vojtech Trefny f31a02
--- a/src/plugins/part.c
Vojtech Trefny f31a02
+++ b/src/plugins/part.c
Vojtech Trefny f31a02
@@ -841,6 +841,14 @@ static gboolean resize_part (PedPartition *part, PedDevice *dev, PedDisk *disk,
Vojtech Trefny f31a02
         constr = ped_constraint_any (dev);
Vojtech Trefny f31a02
 
Vojtech Trefny f31a02
     geom = ped_disk_get_max_partition_geometry (disk, part, constr);
Vojtech Trefny f31a02
+    if (!geom) {
Vojtech Trefny f31a02
+        set_parted_error (error, BD_PART_ERROR_FAIL);
Vojtech Trefny f31a02
+        g_prefix_error (error, "Failed to create geometry for partition on device '%s'", dev->path);
Vojtech Trefny f31a02
+        ped_constraint_destroy (constr);
Vojtech Trefny f31a02
+        finish_alignment_constraint (disk, orig_flag_state);
Vojtech Trefny f31a02
+        return FALSE;
Vojtech Trefny f31a02
+    }
Vojtech Trefny f31a02
+
Vojtech Trefny f31a02
     if (!ped_geometry_set_start (geom, start)) {
Vojtech Trefny f31a02
         set_parted_error (error, BD_PART_ERROR_FAIL);
Vojtech Trefny f31a02
         g_prefix_error (error, "Failed to set partition start on device '%s'", dev->path);
Vojtech Trefny f31a02
-- 
Vojtech Trefny f31a02
2.40.1
Vojtech Trefny f31a02