all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 377c09d0a5b152e4c94c1f5e70d338f023182a8c 1544 bytes (raw)
name: gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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


debug log:

solving 377c09d0a5 ...
found 377c09d0a5 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.