Compare commits

...

No commits in common. "c8s" and "c9s" have entirely different histories.
c8s ... c9s

8 changed files with 763 additions and 140 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
SOURCES/glib-2.70.1.tar.xz
/glib-2.70.1.tar.xz
/glib-*.tar.xz

View File

@ -1,28 +1,242 @@
From 7f4f4354540440c0a8a37beaccbec8bc7fc15ec7 Mon Sep 17 00:00:00 2001
From: Erik van Pienbroek <epienbro@fedoraproject.org>
Date: Mon, 27 Aug 2012 23:28:54 +0200
Subject: [PATCH] Use CreateFile on Win32 to make sure g_unlink always works
The functions g_open(), g_creat() and g_fopen() defer to _wopen(),
_wcreat() and _wfopen() respectively. This is very similar to
the corresponding arrangement for Linux. However, those Windows
functions do not support renaming a file whilst it's open. As a
result, g_rename() behaves differently on the Windows platform
compared to its Linux behaviour, where files can be renamed even
while there are file handles still open. Resolved this by using
the Win32 API function CreateFile() instead of _wopen(), _wcreat()
and _wfopen()
Patch initially created by John Emmas
---
glib/gstdio.c | 259 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 233 insertions(+), 26 deletions(-)
diff --git a/glib/gstdio.c b/glib/gstdio.c
index 6d763e1..c1d072f 100644
--- a/glib/gstdio.c
+++ b/glib/gstdio.c
@@ -1045,6 +1045,11 @@ g_open (const gchar *filename,
diff -rupN --no-dereference glib-2.78.0/gio/tests/org.gtk.test.gschema.override.orig glib-2.78.0-new/gio/tests/org.gtk.test.gschema.override.orig
--- glib-2.78.0/gio/tests/org.gtk.test.gschema.override.orig 2023-09-08 15:42:18.000000000 +0200
+++ glib-2.78.0-new/gio/tests/org.gtk.test.gschema.override.orig 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-[org.gtk.test.per-desktop:GNOME-Classic]
-desktop = "GNOME Classic"
diff -rupN --no-dereference glib-2.78.0/gio/tests/org.gtk.test.gschema.xml.orig glib-2.78.0-new/gio/tests/org.gtk.test.gschema.xml.orig
--- glib-2.78.0/gio/tests/org.gtk.test.gschema.xml.orig 2023-09-08 15:42:18.000000000 +0200
+++ glib-2.78.0-new/gio/tests/org.gtk.test.gschema.xml.orig 1970-01-01 01:00:00.000000000 +0100
@@ -1,225 +0,0 @@
-<schemalist>
-
- <schema id="org.gtk.test" path="/tests/" gettext-domain="test">
- <key name="greeting" type="s">
- <default l10n="messages">"Hello, earthlings"</default>
- <summary>A greeting</summary>
- <description>
- Greeting of the invading martians
- </description>
- </key>
- <key name="farewell" type="s">
- <default l10n="messages">"So long"</default>
- </key>
-
- <child name='basic-types' schema='org.gtk.test.basic-types'/>
- <child name='complex-types' schema='org.gtk.test.complex-types'/>
- <child name='localized' schema='org.gtk.test.localized'/>
- </schema>
-
- <schema id="org.gtk.test.no-path">
- <key name="test-boolean" type="b">
- <default>true</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.basic-types" path="/tests/basic-types/">
- <key name="test-boolean" type="b">
- <default>true</default>
- </key>
- <key name="test-byte" type="y">
- <default>25</default>
- </key>
- <key name="test-int16" type="n">
- <default>-1234</default>
- </key>
- <key name="test-uint16" type="q">
- <default>1234</default>
- </key>
- <key name="test-int32" type="i">
- <default>-123456</default>
- </key>
- <key name="test-uint32" type="u">
- <default>123456</default>
- </key>
- <key name="test-int64" type="x">
- <default>-123456789</default>
- </key>
- <key name="test-uint64" type="t">
- <default>123456789</default>
- </key>
- <key name="test-double" type="d">
- <default>123.456</default>
- </key>
- <key name="test-string" type="s">
- <default>"a string, it seems"</default>
- </key>
- <key name="test-objectpath" type="o">
- <default>"/a/object/path"</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.complex-types" path="/tests/complex-types/">
- <key name="test-tuple" type="(s(ii))">
- <default>("one",(2,3))</default>
- </key>
- <key name="test-array" type="ai">
- <default>[0,1,2,3,4,5]</default>
- </key>
- <key name="test-dict" type="a{sau}">
- <default>
- {
- "AC": [0,0, 0,0,0,0,0,0],
- "IV": [0,0, 0,0,0,0,0,0]
- }
- </default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.localized" path="/tests/localized/" gettext-domain="test">
- <key name="error-message" type="s">
- <default l10n="messages">"Unnamed"</default>
- </key>
- <key name="backspace" type="s">
- <default l10n="messages" context="keyboard label">"BackSpace"</default>
- </key>
- <key name="midnight" type="s">
- <default l10n="time">"12:00 AM"</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.binding" path="/tests/binding/">
- <key name="bool" type="b">
- <default>false</default>
- </key>
- <key name="anti-bool" type="b">
- <default>false</default>
- </key>
- <key name="byte" type="y">
- <default>0</default>
- </key>
- <key name="int16" type="n">
- <default>0</default>
- </key>
- <key name="uint16" type="q">
- <default>0</default>
- </key>
- <key name="int" type="i">
- <default>0</default>
- </key>
- <key name="uint" type="u">
- <default>0</default>
- </key>
- <key name="int64" type="x">
- <default>0</default>
- </key>
- <key name="uint64" type="t">
- <default>0</default>
- </key>
- <key name="double" type="d">
- <default>0</default>
- </key>
- <key name="string" type="s">
- <default>""</default>
- </key>
- <key name="chararray" type="ay">
- <default>[48, 49]</default>
- </key>
- <key name="strv" type="as">
- <default>[]</default>
- </key>
- <key name="enum" enum="org.gtk.test.TestEnum">
- <default>'foo'</default>
- </key>
- <key name="flags" flags="org.gtk.test.TestFlags">
- <default>['mourning', 'laughing']</default>
- </key>
- <key name="range" type='u'>
- <default>33</default>
- <range min="2" max="44"/>
- </key>
- </schema>
-
- <schema id='org.gtk.test.enums' path='/tests/enums/'>
- <key name='test' enum='org.gtk.test.TestEnum'>
- <default>'bar'</default>
- <aliases>
- <alias value='qux' target='quux'/>
- </aliases>
- </key>
- <key name='f-test' flags='org.gtk.test.TestFlags'>
- <default>[]</default>
- <aliases>
- <alias value='speaking' target='talking'/>
- </aliases>
- </key>
- </schema>
-
- <schema id='org.gtk.test.enums.direct' path='/tests/enums/'>
- <key name='f-test' type='as'>
- <default>[]</default>
- </key>
- <key name='test' type='s'>
- <default>'bar'</default>
- </key>
- </schema>
-
- <schema id='org.gtk.test.range' path='/tests/range/'>
- <key name='val' type='i'>
- <default>33</default>
- <range min='2' max='44'/>
- </key>
- </schema>
-
- <schema id='org.gtk.test.range.direct' path='/tests/range/'>
- <key name='val' type='i'>
- <default>33</default>
- </key>
- </schema>
-
- <schema id='org.gtk.test.mapped' path='/tests/mapped/'>
- <key name='val' type='i'>
- <default>0</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.descriptions" path="/a/">
- <key name='a' type='i'>
- <summary>
- a paragraph.
-
- with some whitespace.
-
- because not everyone has a great editor.
-
-
-
-
- lots of space is as one.
- </summary>
- <default>0</default>
- </key>
- </schema>
-
- <schema id='org.gtk.test.extends.base'>
- <key name='int32' type='i'>
- <default>0</default>
- </key>
- <key name='string' type='s'>
- <default>''</default>
- </key>
- </schema>
- <schema id='org.gtk.test.extends.extended' extends='org.gtk.test.extends.base'>
- <override name="int32">42</override>
- <key name='another-int32' type='i'>
- <default>0</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.per-desktop" path="/tests/per-desktop/">
- <key name="desktop" type="s">
- <default>"GNOME"</default>
- </key>
- </schema>
-
-</schemalist>
diff -rupN --no-dereference glib-2.78.0/glib/gstdio.c glib-2.78.0-new/glib/gstdio.c
--- glib-2.78.0/glib/gstdio.c 2023-09-08 15:42:18.000000000 +0200
+++ glib-2.78.0-new/glib/gstdio.c 2023-09-19 11:45:02.396539056 +0200
@@ -1052,6 +1052,11 @@ g_open (const gchar *filename,
int mode)
{
#ifdef G_OS_WIN32
@ -34,7 +248,7 @@ index 6d763e1..c1d072f 100644
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
int retval;
int save_errno;
@@ -1055,12 +1060,114 @@ g_open (const gchar *filename,
@@ -1062,12 +1067,114 @@ g_open (const gchar *filename,
return -1;
}
@ -55,8 +269,7 @@ index 6d763e1..c1d072f 100644
+ g_free (wfilename);
+ return -1;
+ }
- g_free (wfilename);
+
+ dwDesiredAccess |= GENERIC_READ;
+ dwSharedAccess |= FILE_SHARE_WRITE;
+ }
@ -68,7 +281,7 @@ index 6d763e1..c1d072f 100644
+ g_free (wfilename);
+ return -1;
+ }
+
+ dwDesiredAccess |= GENERIC_WRITE;
+ }
+ if (flags & _O_RDWR)
@ -133,7 +346,8 @@ index 6d763e1..c1d072f 100644
+ }
+ else
+ retval = _open_osfhandle((long)hFile, flags);
+
- g_free (wfilename);
+ if ((-1) != retval)
+ {
+ /* We have a valid file handle. Set its translation mode to text or binary, as appropriate */
@ -144,7 +358,7 @@ index 6d763e1..c1d072f 100644
+ else
+ _setmode(retval, _O_BINARY);
+ }
+
+ save_errno = errno;
+ g_free (wfilename);
errno = save_errno;
@ -152,7 +366,7 @@ index 6d763e1..c1d072f 100644
return retval;
#else
int fd;
@@ -1108,6 +1215,8 @@ g_creat (const gchar *filename,
@@ -1115,6 +1222,8 @@ g_creat (const gchar *filename,
int mode)
{
#ifdef G_OS_WIN32
@ -161,7 +375,7 @@ index 6d763e1..c1d072f 100644
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
int retval;
int save_errno;
@@ -1118,12 +1227,41 @@ g_creat (const gchar *filename,
@@ -1125,12 +1234,41 @@ g_creat (const gchar *filename,
return -1;
}
@ -172,8 +386,7 @@ index 6d763e1..c1d072f 100644
+ if (! (mode & _S_IWRITE))
+ dwFlagsAndAttributes = FILE_ATTRIBUTE_READONLY; /* Sets file to 'read only' after the file gets closed */
+ }
- g_free (wfilename);
+
+ hFile = CreateFileW(wfilename, (GENERIC_READ | GENERIC_WRITE), (FILE_SHARE_READ | FILE_SHARE_DELETE),
+ NULL, CREATE_ALWAYS, dwFlagsAndAttributes, NULL);
+
@ -200,13 +413,14 @@ index 6d763e1..c1d072f 100644
+ retval = _open_osfhandle((long)hFile, _O_RDWR);
+ save_errno = errno;
+ g_free (wfilename);
g_free (wfilename);
-
errno = save_errno;
+
return retval;
#else
return creat (filename, mode);
@@ -1565,34 +1703,102 @@ g_fopen (const gchar *filename,
@@ -1572,34 +1710,102 @@ g_fopen (const gchar *filename,
const gchar *mode)
{
#ifdef G_OS_WIN32
@ -263,7 +477,7 @@ index 6d763e1..c1d072f 100644
+ if (('c' == priv_mode[2]) || ('n' == priv_mode[2]))
+ priv_mode[2] = '\0';
+ else
+ {
+ {
+ if (0 == strcmp(priv_mode, "a+b"))
+ flags = _O_RDWR | _O_CREAT | _O_APPEND | _O_BINARY;
+ else if (0 == strcmp(priv_mode, "a+t"))
@ -281,14 +495,14 @@ index 6d763e1..c1d072f 100644
+ errno = EINVAL;
+ goto out;
+ }
+ }
+ }
+ }
+ if (2 == strlen(priv_mode))
+ {
+ if (('c' == priv_mode[1]) || ('n' == priv_mode[1]))
+ priv_mode[1] = '\0';
+ else
+ {
+ {
+ if (0 == strcmp(priv_mode, "a+"))
+ flags = _O_RDWR | _O_CREAT | _O_APPEND;
+ else if (0 == strcmp(priv_mode, "ab"))
@ -308,7 +522,7 @@ index 6d763e1..c1d072f 100644
+ errno = EINVAL;
+ goto out;
+ }
+ }
+ }
+ }
+ if (1 == strlen(priv_mode))
+ {
@ -337,6 +551,3 @@ index 6d763e1..c1d072f 100644
return retval;
#else
return fopen (filename, mode);
--
1.7.11.4

View File

@ -0,0 +1,45 @@
From 25833cefda24c60af913d6f2d532b5afd608b821 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Thu, 19 Sep 2024 18:35:53 +0100
Subject: [PATCH] gsocks4aproxy: Fix a single byte buffer overflow in connect
messages
`SOCKS4_CONN_MSG_LEN` failed to account for the length of the final nul
byte in the connect message, which is an addition in SOCKSv4a vs
SOCKSv4.
This means that the buffer for building and transmitting the connect
message could be overflowed if the username and hostname are both
`SOCKS4_MAX_LEN` (255) bytes long.
Proxy configurations are normally statically configured, so the username
is very unlikely to be near its maximum length, and hence this overflow
is unlikely to be triggered in practice.
(Commit message by Philip Withnall, diagnosis and fix by Michael
Catanzaro.)
Fixes: #3461
---
gio/gsocks4aproxy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gio/gsocks4aproxy.c b/gio/gsocks4aproxy.c
index 3dad118eb7..b3146d08fd 100644
--- a/gio/gsocks4aproxy.c
+++ b/gio/gsocks4aproxy.c
@@ -79,9 +79,9 @@ g_socks4a_proxy_init (GSocks4aProxy *proxy)
* +----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
* | VN | CD | DSTPORT | DSTIP | USERID |NULL| HOST | | NULL |
* +----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
- * 1 1 2 4 variable 1 variable
+ * 1 1 2 4 variable 1 variable 1
*/
-#define SOCKS4_CONN_MSG_LEN (9 + SOCKS4_MAX_LEN * 2)
+#define SOCKS4_CONN_MSG_LEN (10 + SOCKS4_MAX_LEN * 2)
static gint
set_connect_msg (guint8 *msg,
const gchar *hostname,
--
GitLab

View File

@ -0,0 +1,261 @@
From 9bcd65ba5fa1b92ff0fb8380faea335ccef56253 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@gnome.org>
Date: Thu, 13 Nov 2025 18:27:22 +0000
Subject: [PATCH 1/2] gconvert: Error out if g_escape_uri_string() would
overflow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If the string to escape contains a very large number of unacceptable
characters (which would need escaping), the calculation of the length of
the escaped string could overflow, leading to a potential write off the
end of the newly allocated string.
In addition to that, the number of unacceptable characters was counted
in a signed integer, which would overflow to become negative, making it
easier for an attacker to craft an input string which would cause an
out-of-bounds write.
Fix that by validating the allocation length, and using an unsigned
integer to count the number of unacceptable characters.
Spotted by treeplus. Thanks to the Sovereign Tech Resilience programme
from the Sovereign Tech Agency. ID: #YWH-PGM9867-134
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3827
Backport 2.86: Changed the translatable error message to re-use an
existing translatable string, to avoid adding new translatable strings
to a stable branch. The re-used string doesnt perfectly match the
error, but its good enough given that no users will ever see it.
---
glib/gconvert.c | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/glib/gconvert.c b/glib/gconvert.c
index 7ad8ca018f..367e9b4661 100644
--- a/glib/gconvert.c
+++ b/glib/gconvert.c
@@ -1336,8 +1336,9 @@ static const gchar hex[] = "0123456789ABCDEF";
/* Note: This escape function works on file: URIs, but if you want to
* escape something else, please read RFC-2396 */
static gchar *
-g_escape_uri_string (const gchar *string,
- UnsafeCharacterSet mask)
+g_escape_uri_string (const gchar *string,
+ UnsafeCharacterSet mask,
+ GError **error)
{
#define ACCEPTABLE(a) ((a)>=32 && (a)<128 && (acceptable[(a)-32] & use_mask))
@@ -1345,7 +1346,7 @@ g_escape_uri_string (const gchar *string,
gchar *q;
gchar *result;
int c;
- gint unacceptable;
+ size_t unacceptable;
UnsafeCharacterSet use_mask;
g_return_val_if_fail (mask == UNSAFE_ALL
@@ -1362,7 +1363,14 @@ g_escape_uri_string (const gchar *string,
if (!ACCEPTABLE (c))
unacceptable++;
}
-
+
+ if (unacceptable >= (G_MAXSIZE - (p - string)) / 2)
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_BAD_URI,
+ _("Invalid hostname"));
+ return NULL;
+ }
+
result = g_malloc (p - string + unacceptable * 2 + 1);
use_mask = mask;
@@ -1387,12 +1395,13 @@ g_escape_uri_string (const gchar *string,
static gchar *
-g_escape_file_uri (const gchar *hostname,
- const gchar *pathname)
+g_escape_file_uri (const gchar *hostname,
+ const gchar *pathname,
+ GError **error)
{
char *escaped_hostname = NULL;
- char *escaped_path;
- char *res;
+ char *escaped_path = NULL;
+ char *res = NULL;
#ifdef G_OS_WIN32
char *p, *backslash;
@@ -1413,10 +1422,14 @@ g_escape_file_uri (const gchar *hostname,
if (hostname && *hostname != '\0')
{
- escaped_hostname = g_escape_uri_string (hostname, UNSAFE_HOST);
+ escaped_hostname = g_escape_uri_string (hostname, UNSAFE_HOST, error);
+ if (escaped_hostname == NULL)
+ goto out;
}
- escaped_path = g_escape_uri_string (pathname, UNSAFE_PATH);
+ escaped_path = g_escape_uri_string (pathname, UNSAFE_PATH, error);
+ if (escaped_path == NULL)
+ goto out;
res = g_strconcat ("file://",
(escaped_hostname) ? escaped_hostname : "",
@@ -1424,6 +1437,7 @@ g_escape_file_uri (const gchar *hostname,
escaped_path,
NULL);
+out:
#ifdef G_OS_WIN32
g_free ((char *) pathname);
#endif
@@ -1757,7 +1771,7 @@ g_filename_to_uri (const gchar *filename,
hostname = NULL;
#endif
- escaped_uri = g_escape_file_uri (hostname, filename);
+ escaped_uri = g_escape_file_uri (hostname, filename, error);
return escaped_uri;
}
--
GitLab
From 7e5489cb921d0531ee4ebc9938da30a02084b2fa Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@gnome.org>
Date: Thu, 13 Nov 2025 18:31:43 +0000
Subject: [PATCH 2/2] fuzzing: Add fuzz tests for g_filename_{to,from}_uri()
These functions could be called on untrusted input data, and since they
do URI escaping/unescaping, they have non-trivial string handling code.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
See: #3827
---
fuzzing/fuzz_filename_from_uri.c | 40 ++++++++++++++++++++++++++++++++
fuzzing/fuzz_filename_to_uri.c | 40 ++++++++++++++++++++++++++++++++
fuzzing/meson.build | 2 ++
3 files changed, 82 insertions(+)
create mode 100644 fuzzing/fuzz_filename_from_uri.c
create mode 100644 fuzzing/fuzz_filename_to_uri.c
diff --git a/fuzzing/fuzz_filename_from_uri.c b/fuzzing/fuzz_filename_from_uri.c
new file mode 100644
index 0000000000..9b7a715f07
--- /dev/null
+++ b/fuzzing/fuzz_filename_from_uri.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2025 GNOME Foundation, Inc.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "fuzz.h"
+
+int
+LLVMFuzzerTestOneInput (const unsigned char *data, size_t size)
+{
+ unsigned char *nul_terminated_data = NULL;
+ char *filename = NULL;
+ GError *local_error = NULL;
+
+ fuzz_set_logging_func ();
+
+ /* ignore @size (g_filename_from_uri() doesnt support it); ensure @data is nul-terminated */
+ nul_terminated_data = (unsigned char *) g_strndup ((const char *) data, size);
+ filename = g_filename_from_uri ((const char *) nul_terminated_data, NULL, &local_error);
+ g_free (nul_terminated_data);
+
+ g_free (filename);
+ g_clear_error (&local_error);
+
+ return 0;
+}
diff --git a/fuzzing/fuzz_filename_to_uri.c b/fuzzing/fuzz_filename_to_uri.c
new file mode 100644
index 0000000000..acb3192035
--- /dev/null
+++ b/fuzzing/fuzz_filename_to_uri.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2025 GNOME Foundation, Inc.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "fuzz.h"
+
+int
+LLVMFuzzerTestOneInput (const unsigned char *data, size_t size)
+{
+ unsigned char *nul_terminated_data = NULL;
+ char *uri = NULL;
+ GError *local_error = NULL;
+
+ fuzz_set_logging_func ();
+
+ /* ignore @size (g_filename_to_uri() doesnt support it); ensure @data is nul-terminated */
+ nul_terminated_data = (unsigned char *) g_strndup ((const char *) data, size);
+ uri = g_filename_to_uri ((const char *) nul_terminated_data, NULL, &local_error);
+ g_free (nul_terminated_data);
+
+ g_free (uri);
+ g_clear_error (&local_error);
+
+ return 0;
+}
diff --git a/fuzzing/meson.build b/fuzzing/meson.build
index addbe90717..05f936eeb2 100644
--- a/fuzzing/meson.build
+++ b/fuzzing/meson.build
@@ -25,6 +25,8 @@ fuzz_targets = [
'fuzz_date_parse',
'fuzz_date_time_new_from_iso8601',
'fuzz_dbus_message',
+ 'fuzz_filename_from_uri',
+ 'fuzz_filename_to_uri',
'fuzz_inet_address_mask_new_from_string',
'fuzz_inet_address_new_from_string',
'fuzz_inet_socket_address_new_from_string',
--
GitLab

View File

@ -1,6 +1,5 @@
--- !Policy
product_versions:
- rhel-8
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: desktop-qe.desktop-ci.tier1-gating.functional}
rules: []

View File

@ -1,22 +1,7 @@
From bc90511c1eb333e26e0bc0eaee62375d0e788db6 Mon Sep 17 00:00:00 2001
From: Erik van Pienbroek <epienbro@fedoraproject.org>
Date: Tue, 16 Apr 2013 11:42:11 +0200
Subject: [PATCH] win32: Prefer the use of constructors over DllMain
This prevents having to depend on DllMain in static libraries
Constructors are available in both the GCC build (GCC 2.7 and later)
and the MSVC build (MSVC 2008 and later using _Pragma, earlier
versions using #pragma)
---
glib/glib-init.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/glib/glib-init.c b/glib/glib-init.c
index 0032ee8..dd6ccbf 100644
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -223,12 +223,14 @@ glib_init (void)
diff -rupN --no-dereference glib-2.63.5/glib/glib-init.c glib-2.63.5-new/glib/glib-init.c
--- glib-2.63.5/glib/glib-init.c 2020-02-03 15:28:28.000000000 +0100
+++ glib-2.63.5-new/glib/glib-init.c 2020-02-11 10:12:24.070832245 +0100
@@ -271,12 +271,14 @@ glib_init (void)
#if defined (G_OS_WIN32)
@ -33,7 +18,7 @@ index 0032ee8..dd6ccbf 100644
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
@@ -238,14 +240,6 @@ DllMain (HINSTANCE hinstDLL,
@@ -286,14 +288,6 @@ DllMain (HINSTANCE hinstDLL,
{
case DLL_PROCESS_ATTACH:
glib_dll = hinstDLL;
@ -48,7 +33,7 @@ index 0032ee8..dd6ccbf 100644
break;
case DLL_THREAD_DETACH:
@@ -259,7 +256,10 @@ DllMain (HINSTANCE hinstDLL,
@@ -318,7 +312,10 @@ DllMain (HINSTANCE hinstDLL,
return TRUE;
}
@ -60,7 +45,7 @@ index 0032ee8..dd6ccbf 100644
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(glib_init_ctor)
@@ -269,7 +266,15 @@ G_DEFINE_CONSTRUCTOR(glib_init_ctor)
@@ -328,7 +325,15 @@ G_DEFINE_CONSTRUCTOR(glib_init_ctor)
static void
glib_init_ctor (void)
{
@ -74,7 +59,5 @@ index 0032ee8..dd6ccbf 100644
+ /* must go after glib_init */
+ g_console_win32_init ();
}
#else
--
1.8.2

View File

@ -1,43 +1,39 @@
%?mingw_package_header
# See https://fedoraproject.org/wiki/Packaging:Python_Appendix#Manual_byte_compilation
%global __python %{__python3}
%{?mingw_package_header}
Name: mingw-glib2
Version: 2.70.1
Release: 1%{?dist}
Version: 2.78.6
Release: 3%{?dist}
Summary: MinGW Windows GLib2 library
License: LGPLv2+
License: LGPL-2.0-or-later
URL: http://www.gtk.org
# first two digits of version
%global release_version %(echo %{version} | awk -F. '{print $1"."$2}')
Source0: http://download.gnome.org/sources/glib/%{release_version}/glib-%{version}.tar.xz
BuildArch: noarch
ExclusiveArch: %{ix86} x86_64
BuildRequires: meson
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: mingw32-filesystem >= 104
BuildRequires: mingw32-filesystem >= 107
BuildRequires: mingw32-gcc
BuildRequires: mingw32-binutils
BuildRequires: mingw32-win-iconv
BuildRequires: mingw32-gettext
BuildRequires: mingw32-libffi
BuildRequires: mingw32-pcre
BuildRequires: mingw32-zlib
BuildRequires: mingw32-pcre2
BuildRequires: mingw32-zlib >= 1.2.13
BuildRequires: mingw64-filesystem >= 104
BuildRequires: mingw64-filesystem >= 107
BuildRequires: mingw64-gcc
BuildRequires: mingw64-binutils
BuildRequires: mingw64-win-iconv
BuildRequires: mingw64-gettext
BuildRequires: mingw64-libffi
BuildRequires: mingw64-pcre
BuildRequires: mingw64-zlib
BuildRequires: mingw64-pcre2
BuildRequires: mingw64-zlib >= 1.2.13
# Native version required for msgfmt use in build
BuildRequires: gettext
@ -48,12 +44,22 @@ BuildRequires: python3-devel
# https://bugzilla.gnome.org/show_bug.cgi?id=674214
Patch1: 0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch
# https://issues.redhat.com/browse/RHEL-67089
# https://gitlab.gnome.org/GNOME/glib/-/issues/3461
Patch2: CVE-2024-52533-buffer-overflow-in-set_connect_msg.patch
# https://issues.redhat.com/browse/RHEL-131012
# https://gitlab.gnome.org/GNOME/glib/-/issues/3827
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4914
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4915
Patch3: CVE-2025-13601-gconvert-Error-out-if-g_escape_uri_string-would-overflow.patch
# Prefer the use of GCC constructors over DllMain
# This prevents having to depend on DllMain in static libraries
# http://lists.fedoraproject.org/pipermail/mingw/2013-March/006429.html
# http://lists.fedoraproject.org/pipermail/mingw/2013-March/006469.html
# https://bugzilla.gnome.org/show_bug.cgi?id=698118
Patch2: glib-prefer-constructors-over-DllMain.patch
#Patch5: glib-prefer-constructors-over-DllMain.patch
%description
MinGW Windows Glib2 library.
@ -62,8 +68,7 @@ MinGW Windows Glib2 library.
%package -n mingw32-glib2
Summary: MinGW Windows Glib2 library for the win32 target
# glib-genmarshal and glib-mkenums are written in Python
# plataform-python due: https://bugzilla.redhat.com/show_bug.cgi?id=1633614
Requires: platform-python
Requires: python3
%description -n mingw32-glib2
MinGW Windows Glib2 library.
@ -80,8 +85,7 @@ Static version of the MinGW Windows GLib2 library.
%package -n mingw64-glib2
Summary: MinGW Windows Glib2 library for the win64 target
# glib-genmarshal and glib-mkenums are written in Python
# plataform-python due: https://bugzilla.redhat.com/show_bug.cgi?id=1633614
Requires: platform-python
Requires: python3
%description -n mingw64-glib2
MinGW Windows Glib2 library.
@ -95,22 +99,25 @@ Requires: mingw64-gettext-static
Static version of the MinGW Windows GLib2 library.
%?mingw_debug_package
%{?mingw_debug_package}
%prep
%setup -q -n glib-%{version}
%patch1 -p1
%patch2 -p1
%autosetup -p1 -n glib-%{version}
%build
%mingw_meson --default-library=both \
--buildtype=release
export MINGW_BUILDDIR_SUFFIX=static
%mingw_meson --default-library=static
%mingw_ninja
export MINGW_BUILDDIR_SUFFIX=shared
%mingw_meson --default-library=shared
%mingw_ninja
%install
export DESTDIR=$RPM_BUILD_ROOT
%mingw_ninja install
export MINGW_BUILDDIR_SUFFIX=static
%mingw_ninja_install
export MINGW_BUILDDIR_SUFFIX=shared
%mingw_ninja_install
# There's a small difference in the file glibconfig.h between the
# shared and the static build:
@ -134,37 +141,39 @@ export DESTDIR=$RPM_BUILD_ROOT
# and -DGOBJECT_STATIC_COMPILATION to their CFLAGS to avoid compile failures
# Drop the folder which was temporary used for installing the static bits
rm -f $RPM_BUILD_ROOT/%{mingw32_libdir}/charset.alias
rm -f $RPM_BUILD_ROOT/%{mingw64_libdir}/charset.alias
rm -f %{buildroot}/%{mingw32_libdir}/charset.alias
rm -f %{buildroot}/%{mingw64_libdir}/charset.alias
# Drop the GDB helper files as we can't use the native Fedora GDB to debug Win32 programs
rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/gdb
rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gdb
rm -rf %{buildroot}%{mingw32_datadir}/gdb
rm -rf %{buildroot}%{mingw64_datadir}/gdb
# Remove the gtk-doc documentation and manpages which duplicate Fedora native
rm -rf $RPM_BUILD_ROOT%{mingw32_mandir}
rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/gtk-doc
rm -rf %{buildroot}%{mingw32_mandir}
rm -rf %{buildroot}%{mingw32_datadir}/gtk-doc
rm -rf $RPM_BUILD_ROOT%{mingw64_mandir}
rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gtk-doc
rm -rf %{buildroot}%{mingw64_mandir}
rm -rf %{buildroot}%{mingw64_datadir}/gtk-doc
# Bash-completion files aren't interesting for mingw
rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/bash-completion
rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/bash-completion
rm -rf %{buildroot}%{mingw32_datadir}/bash-completion
rm -rf %{buildroot}%{mingw64_datadir}/bash-completion
# The .def files are also of no use to other binaries
rm -f $RPM_BUILD_ROOT%{mingw32_libdir}/*.def
rm -f $RPM_BUILD_ROOT%{mingw64_libdir}/*.def
rm -f %{buildroot}%{mingw32_libdir}/*.def
rm -f %{buildroot}%{mingw64_libdir}/*.def
# The gdbus-codegen pieces are already in the native glib2 package
rm -f $RPM_BUILD_ROOT%{mingw32_bindir}/gdbus-codegen
rm -rf $RPM_BUILD_ROOT%{mingw32_libdir}/gdbus-2.0
rm -f %{buildroot}%{mingw32_bindir}/gdbus-codegen
rm -rf %{buildroot}%{mingw32_libdir}/gdbus-2.0
sed -i 's|gdbus_codegen=.*|gdbus_codegen=%{_bindir}/gdbus-codegen|g' %{buildroot}%{mingw32_libdir}/pkgconfig/gio-2.0.pc
rm -f $RPM_BUILD_ROOT%{mingw64_bindir}/gdbus-codegen
rm -rf $RPM_BUILD_ROOT%{mingw64_libdir}/gdbus-2.0
rm -f %{buildroot}%{mingw64_bindir}/gdbus-codegen
rm -rf %{buildroot}%{mingw64_libdir}/gdbus-2.0
sed -i 's|gdbus_codegen=.*|gdbus_codegen=%{_bindir}/gdbus-codegen|g' %{buildroot}%{mingw64_libdir}/pkgconfig/gio-2.0.pc
# Drop all .la files
find $RPM_BUILD_ROOT -name "*.la" -delete
find %{buildroot} -name "*.la" -delete
%mingw_find_lang glib20
@ -175,6 +184,7 @@ find $RPM_BUILD_ROOT -name "*.la" -delete
%py_byte_compile %{__python3} %{buildroot}%{mingw64_datadir}/glib-2.0/gdb
%py_byte_compile %{__python3} %{buildroot}%{mingw64_datadir}/glib-2.0/codegen
# Win32
%files -n mingw32-glib2 -f mingw32-glib20.lang
%license COPYING
@ -279,33 +289,148 @@ find $RPM_BUILD_ROOT -name "*.la" -delete
%changelog
* Thu Dec 23 2021 Yan Vugenfirer <yvugenfi@redhat.com> 2.70.1-1
- Update to 2.70.1
- Resolves: rhbz#2034959
* Mon Dec 8 2025 Konstantin Kostiuk <kkostiuk@redhat.com> - 2.78.6-3
- Resolves: RHEL-131012 - CVE-2025-13601 mingw-glib2: Integer overflow in in g_escape_uri_string()
* Thu Aug 05 2021 Uri Lublin <uril@redhat.com> - 2.66.7-2
- Rebuilt
Resolves: rhbz#1939111 (CVE-2021-27219)
Resolves: rhbz#1935248
* Tue Nov 26 2024 Konstantin Kostiuk <kkostiuk@redhat.com> - 2.78.6-2
- Resolves: RHEL-67088 - CVE-2024-52533 mingw-glib2: buffer overflow in set_connect_msg()
* Sun Feb 21 2021 Basil Salman <bsalman@redhat.com> - 2.66.7-1
* Tue May 21 2024 Konstantin Kostiuk <kkostiuk@redhat.com> - 2.78.6-1
- Bump glib2 version 2.78.6
- Fix CVEs: CVE-2024-34397
- Resolves: RHEL-35776
* Thu Oct 26 2023 Konstantin Kostiuk <kkostiuk@redhat.com> - 2.78.0-1
- Bump glib2 version 2.78.0
- Drop DesktopQE gating
- Fix CVEs: CVE-2023-32636, CVE-2023-29499, CVE-2023-32611, CVE-2023-32665, DoS
- Resolves: RHEL-5019
- Resolves: RHEL-5020
- Resolves: RHEL-5092
- Resolves: RHEL-5093
- Resolves: RHEL-5094
* Mon Aug 7 2023 Konstantin Kostiuk <kkostiuk@redhat.com> - 2.70.1-4
- Fix Glib2 build
- Resolves: RHEL-1056
* Mon Aug 7 2023 Konstantin Kostiuk <kkostiuk@redhat.com> - 2.70.1-3
- Update license to SPDX format
- Resolves: RHEL-1056
* Mon Aug 08 2022 Konstantin Kostiuk <kkostiuk@redhat.com> - 2.70.1-2
- Rebuild for mingw-zlib update
resolves: rhbz#2116278
* Mon Oct 04 2021 Richard W.M. Jones <rjones@redhat.com> - 2.66.7-4
- Rebuild for changed mingw-libffi soname
resolves: rhbz#2009943
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.66.7-3
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.66.7-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Fri Mar 05 2021 Sandro Mani <manisandro@gmail.com> - 2.66.7-1
- Update to 2.66.7
- Rebuild from newer version that fixes CVE-2021-27219
- Resolves: rhbz#1928649
* Tue Feb 16 2021 Basil Salman <bsalman@redhat.com> - 2.66.4-1
- Update to 2.66.4
- Dropped upstreamed patches
- Switched to meson
Resolves: rhbz#1928649
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.66.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Sep 27 2018 Victor Toso <victortoso@redhat.com> - 2.56.1-3
- Use platform-python in Require
Related: rhbz#1633614
* Mon Oct 19 2020 Sandro Mani <manisandro@gmail.com> - 2.66.2-1
- Update to 2.66.2
* Thu Aug 16 2018 Snir Sheriber <ssheribe@redhat.com> - 2.56.1-2
- ExclusiveArch: i686, x86_64
Related: rhbz#1615874
* Mon Oct 05 2020 Sandro Mani <manisandro@gmail.com> - 2.66.1-1
- Update to 2.66.1
* Tue Sep 15 2020 Sandro Mani <manisandro@gmail.com> - 2.66.0-1
- Update to 2.66.0
* Wed Aug 12 13:36:55 GMT 2020 Sandro Mani <manisandro@gmail.com> - 2.64.3-3
- Rebuild (mingw-gettext)
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.64.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri May 22 2020 Sandro Mani <manisandro@gmail.com> - 2.64.3-1
- Update to 2.64.3
* Mon Apr 20 2020 Sandro Mani <manisandro@gmail.com> - 2.64.2-2
- Rebuild (gettext)
* Sat Apr 11 2020 Sandro Mani <manisandro@gmail.com> - 2.64.2-1
- Update to 2.64.2
* Thu Mar 12 2020 Sandro Mani <manisandro@gmail.com> - 2.64.1-1
- Update to 2.64.1
* Fri Mar 06 2020 Sandro Mani <manisandro@gmail.com> - 2.64.0-1
- Update to 2.64.0
* Tue Feb 25 2020 Sandro Mani <manisandro@gmail.com> - 2.63.6-1
- Update to 2.63.6
* Tue Feb 11 2020 Sandro Mani <manisandro@gmail.com> - 2.63.5-2
- Backport proposed patch for CVE-2020-6750
* Mon Feb 03 2020 Sandro Mani <manisandro@gmail.com> - 2.63.5-1
- Update to 2.63.5
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.63.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Jan 24 2020 Sandro Mani <manisandro@gmail.com> - 2.63.4-1
- Update to 2.63.4
* Mon Dec 16 2019 Sandro Mani <manisandro@gmail.com> - 2.63.3-1
- Update to 2.63.3
* Tue Dec 03 2019 Sandro Mani <manisandro@gmail.com> - 2.63.2-1
- Update to 2.63.2
* Tue Oct 08 2019 Sandro Mani <manisandro@gmail.com> - 2.63.0-2
- Rebuild (Changes/Mingw32GccDwarf2)
* Fri Oct 04 2019 Sandro Mani <manisandro@gmail.com> - 2.63.0-1
- Update to 2.63.0
* Mon Sep 16 2019 Sandro Mani <manisandro@gmail.com> - 2.62.0-1
- Update to 2.62.0
* Wed Sep 04 2019 Sandro Mani <manisandro@gmail.com> - 2.61.3-1
- Update to 2.61.3
* Thu Aug 15 2019 Fabiano Fidêncio <fidencio@redhat.com> - 2.61.2-1
- Update to 2.61.2
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.58.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.58.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Jan 22 2019 Kalev Lember <klember@redhat.com> - 2.58.3-1
- Update to 2.58.3
* Tue Jan 08 2019 Kalev Lember <klember@redhat.com> - 2.58.2-1
- Update to 2.58.2
* Fri Sep 21 2018 Kalev Lember <klember@redhat.com> - 2.58.1-1
- Update to 2.58.1
* Thu Aug 02 2018 Thomas Sailer <t.sailer@alumni.ethz.ch> - 2.57.2-1
- Update to 2.57.2
* Thu Aug 02 2018 Thomas Sailer <t.sailer@alumni.ethz.ch> - 2.57.1-1
- Update to 2.57.1
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.56.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.56.1-2
- Rebuilt for Python 3.7
* Mon May 28 2018 Thomas Sailer <t.sailer@alumni.ethz.ch> - 2.56.1-1
- Update to 2.56.1

View File

@ -1 +1 @@
SHA512 (glib-2.70.1.tar.xz) = 639317c98ab72ad853608ab4d395484daff135c0222556c51ca93fd8533c5759db14478beda964e4feb02bb2737a46a4eda25063f98a9c6ba6ae4bc5d74bf5e1
SHA512 (glib-2.78.6.tar.xz) = 8d75f8fd77b6309215ca86a0c7648878efe11051f18b279840c137669017ea4066388f8682367e4ea3f154333d833c9dc28ccd4a66a91f0c3854a40a2838f8da