Package: gdisk
Version: 1.0.9-2
Severity: normal
X-Debbugs-Cc: none, Hilko Bengen <[email protected]>

Dear Maintainer,

Please find attached the debdiff corresponding to my recent
non-maintainer upload of gdisk/1.0.9-2.1 to DELAYED/5. Feel free
reschedule or cancel my upload as you see fit.

Cheers,
-Hilko

diff -Nru gdisk-1.0.9/debian/changelog gdisk-1.0.9/debian/changelog
--- gdisk-1.0.9/debian/changelog	2022-06-02 14:42:03.000000000 +0200
+++ gdisk-1.0.9/debian/changelog	2022-10-16 14:32:11.000000000 +0200
@@ -1,3 +1,11 @@
+gdisk (1.0.9-2.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add patch by HÃ¥vard F. Aasen to fix data corruption, FTBFS with
+    popt 1.19 (Closes: #1020446)
+
+ -- Hilko Bengen <[email protected]>  Sun, 16 Oct 2022 14:32:11 +0200
+
 gdisk (1.0.9-2) unstable; urgency=medium
 
   * Fix UUID generation (Closes: #1011006)
diff -Nru gdisk-1.0.9/debian/patches/handle-plugged-memory-leak-from-popt gdisk-1.0.9/debian/patches/handle-plugged-memory-leak-from-popt
--- gdisk-1.0.9/debian/patches/handle-plugged-memory-leak-from-popt	1970-01-01 01:00:00.000000000 +0100
+++ gdisk-1.0.9/debian/patches/handle-plugged-memory-leak-from-popt	2022-10-16 14:32:11.000000000 +0200
@@ -0,0 +1,42 @@
+From: =?utf-8?b?IkjDpXZhcmQgRi4gQWFzZW4i?= <[email protected]>
+Date: Sat, 15 Oct 2022 18:55:20 +0200
+Subject: Handle plugged memory leak from popt
+
+With popt version 1.19, a memory leak was plugged. gdisk (sdisk) assumed
+the value returned by poptGetArg() would remain usable forever because
+popt has leaked the value for quite a long time.
+
+This patch consist of one incomplete fix, that has been included in the
+official repository, and one that of this writing, is still an open PR.
+
+Origin: upstream, https://sourceforge.net/p/gptfdisk/code/ci/5d5e76d369a412bfb3d2cebb5fc0a7509cef878d/
+Origin: upstream, https://sourceforge.net/p/gptfdisk/code/merge-requests/28/
+Bug-Debian: https://bugs.debian.org/1020446
+---
+ gptcl.cc | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/gptcl.cc b/gptcl.cc
+index 34c9421..ab95239 100644
+--- a/gptcl.cc
++++ b/gptcl.cc
+@@ -156,9 +156,10 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
+ 
+    // Assume first non-option argument is the device filename....
+    device = (char*) poptGetArg(poptCon);
+-   poptResetContext(poptCon);
+ 
+    if (device != NULL) {
++      device = strdup(device);
++      poptResetContext(poptCon);
+       JustLooking(); // reset as necessary
+       BeQuiet(); // Tell called functions to be less verbose & interactive
+       if (LoadPartitions((string) device)) {
+@@ -498,6 +499,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
+          cerr << "Error encountered; not saving changes.\n";
+          retval = 4;
+       } // if
++      free(device);
+    } // if (device != NULL)
+    poptFreeContext(poptCon);
+    return retval;
diff -Nru gdisk-1.0.9/debian/patches/series gdisk-1.0.9/debian/patches/series
--- gdisk-1.0.9/debian/patches/series	2022-06-02 14:39:46.000000000 +0200
+++ gdisk-1.0.9/debian/patches/series	2022-10-16 14:32:11.000000000 +0200
@@ -1 +1,2 @@
 fix-uuid-generation
+handle-plugged-memory-leak-from-popt

Reply via email to