diff mbox series

[bug#69652,gnome-team,v2,3/3] gnu: orbit2: Fix bug on 32-bit systems.

Message ID 6bb82d56807c366da0609ea763a01b18205baf2b.1709974034.git.vivien@planete-kraus.eu
State New
Headers show
Series FIX that damn orbit2 | expand

Commit Message

Vivien Kraus March 9, 2024, 8:43 a.m. UTC
* gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/gnome.scm (orbit2): Use it here.

Change-Id: I72e10fc9d8a5421a7ec6b4ccf1425008b322ea3f
---
 gnu/local.mk                                  |  1 +
 gnu/packages/gnome.scm                        |  4 +-
 .../orbit2-fix-array-allocation-32bit.patch   | 40 +++++++++++++++++++
 3 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index dcd320fec4..9fbfc754a0 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1781,6 +1781,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/opentaxsolver-file-browser-fix.patch     \
   %D%/packages/patches/open-zwave-hidapi.patch			\
   %D%/packages/patches/orangeduck-mpc-fix-pkg-config.patch	\
+  %D%/packages/patches/orbit2-fix-array-allocation-32bit.patch \
   %D%/packages/patches/orpheus-cast-errors-and-includes.patch	\
   %D%/packages/patches/osip-CVE-2017-7853.patch			\
   %D%/packages/patches/ots-no-include-missing-file.patch	\
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 8b69a231af..103065141e 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -3797,7 +3797,9 @@  (define-public orbit2
                                     upstream-name "-" version ".tar.bz2")))
               (sha256
                (base32
-                "0l3mhpyym9m5iz09fz0rgiqxl2ym6kpkwpsp1xrr4aa80nlh1jam"))))
+                "0l3mhpyym9m5iz09fz0rgiqxl2ym6kpkwpsp1xrr4aa80nlh1jam"))
+              (patches
+               (search-patches "orbit2-fix-array-allocation-32bit.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list
diff --git a/gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch b/gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch
new file mode 100644
index 0000000000..377c09d0a5
--- /dev/null
+++ b/gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch
@@ -0,0 +1,40 @@ 
+From 28067b88ad91e794675734bc92bd9c8653b4a46a Mon Sep 17 00:00:00 2001
+Message-ID: <28067b88ad91e794675734bc92bd9c8653b4a46a.1709973702.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Sat, 9 Mar 2024 09:36:56 +0100
+Subject: [PATCH] corba-loc: Do not allocate more tokens than necessary.
+
+To split the list of locations, the code calls g_strsplit with the
+last argument set to G_MAXINT.  It means that g_strsplit will try to
+allocate a huge array (G_MAXINT + 1, for the final NULL), mostly
+filled with NULL.  Unfortunately, on 32-bit systems, this is one past
+the authorized length for an array.  Previous versions of glib would
+not care, but the new version now raises an error if this happens.
+
+To get an array of the appropriate size, we can just pass -1 to the
+last argument.
+
+* src/orb/orb-core/corba-loc.c (ORBit_corbaloc_parse): Replace
+G_MAXINT with -1.
+---
+ src/orb/orb-core/corba-loc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/orb/orb-core/corba-loc.c b/src/orb/orb-core/corba-loc.c
+index abfcaa29..6492d392 100644
+--- a/src/orb/orb-core/corba-loc.c
++++ b/src/orb/orb-core/corba-loc.c
+@@ -309,7 +309,7 @@ ORBit_corbaloc_parse (const gchar       *corbaloc)
+ 	if (!(objkey = orbit_url_decode (okey)))
+ 		goto ret_error;
+ 	
+-	if (!(token = g_strsplit (loc, ",", G_MAXINT))) 
++	if (!(token = g_strsplit (loc, ",", -1)))
+ 		goto ret_error;
+ 
+ 	/* [ 'iiop' ]   ':' [ '//' ] [ version '@' ] host [ ':' port ] */
+
+base-commit: 144be2e9860286c83f009e7689250e0af977cc5e
+-- 
+2.41.0
+