1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2026-10-24 00:49:00 +03:00

32928 Commits

Author SHA1 Message Date
Philip Withnall
43bc79ea88 2.88.3
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.88.3
2026-07-29 14:17:36 +01:00
Emmanuele Bassi
a70d033974 Merge branch 'backport-5248-5249-meson-gcc-fixes-glib-2-88' into 'glib-2-88'
Backport !5248, !5249: several Meson/gcc fixes to glib-2-88

See merge request GNOME/glib!5259
2026-07-29 14:14:44 +01:00
Philip Withnall
480134598f build: Fix a deprecation warning from Meson 1.12
It warns that configured files must be referred to by reference rather
than by name, and that support for the latter will be dropped with Meson
2.0.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-07-29 13:49:49 +01:00
Philip Withnall
3f9dc13e37 build: Rename a Meson variable
This introduces no functional changes, but will simplify the following
commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-07-29 13:49:45 +01:00
Philip Withnall
e012f640c9 tests: Move a feature test macro definition
Feature test macros always need to be defined before any headers are
included. This triggers a redefinition warning with GCC 16 and the new
gnu11 C level.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-07-29 13:49:40 +01:00
Philip Withnall
41e4ba0d5a tests: Fix some const warnings
GCC 16 is a little better than before at detecting accidentally dropped
`const` modifiers.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-07-29 13:49:34 +01:00
Philip Withnall
c17e78fc44 Merge branch 'backport-5238-macos-poll-clear-glib-2-88' into 'glib-2-88'
Backport !5238 “gpoll: Correctly zero-out heap-allocated fd_sets on macOS” to glib-2-88

See merge request GNOME/glib!5242
2026-07-22 10:20:01 +00:00
Emmanuele Bassi
4e41751c76 Merge branch 'translatable-string-glib-2-88' into 'glib-2-88'
gdbusauth: Unmark a new string as translatable

See merge request GNOME/glib!5243
2026-07-10 16:40:39 +01:00
Philip Withnall
98930ba8d3 gdbusauth: Unmark a new string as translatable
In the backport commit 4235f7b42 a new string was accidentally added
which broke string freeze. Because it’s very unlikely this string will
be shown (it’s an error message only shown if running a custom D-Bus
server and it’s being attacked by a malicious client), just drop the
translation marker on this stable branch.

The string will get translated for the next stable release on `main`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: https://gitlab.gnome.org/Teams/Translation/Coordination/-/work_items/529
2026-07-10 16:07:41 +01:00
Emmanuele Bassi
c3a332fb2e Merge branch 'backport-5240-gdbus-auth-limiting-glib-2-88' into 'glib-2-88'
Backport !5240 “gdbusauth: Limit length of lines read from client” to glib-2-88

See merge request GNOME/glib!5241
2026-07-10 16:03:18 +01:00
Alex Kirszenberg
02689c1aae gpoll: Correctly zero-out heap-allocated fd_sets on macOS 2026-07-10 15:52:55 +01:00
Philip Withnall
4235f7b42b gdbusauth: Limit length of lines read from client
The client isn’t trusted at this point, and there was previously nothing
limiting how long a line `GDBusAuth` would read. So an untrusted client
could exhaust the server’s memory by sending anything except `\r\n`.

Fix that by applying a reasonably length limit when reading a line, and
add a unit test.

Spotted by Gitee Codepecker Lab.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3985
2026-07-10 15:37:32 +01:00
Marco Trevisan
ca46dff809 Merge branch 'backport-5223-const-shenanigans-glib-2-88' into 'glib-2-88'
Backport !5223 “Drop G_GNUC_CONST for *_get_type” to glib-2-88

See merge request GNOME/glib!5225
2026-07-04 13:59:31 +02:00
Philip Withnall
b7cea87cc4 codegen: Drop an inappropriate G_GNUC_CONST from inside a code comment
Might as well have this comment reflect reality (see the previous few
commits).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-06-25 18:07:04 +01:00
Philip Withnall
fc6e8e3b27 gquark: Fix an incorrect G_GNUC_CONST annotation on g_quark_to_string()
It’s actually `G_GNUC_PURE` as its return value depends on the global
quark table.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-06-25 18:02:00 +01:00
Sam James
5c2f36682a gtype: downgrade some (non-*_get_type) G_GNUC_CONST -> G_GNUC_PURE
g_type_check_is_value_type and g_type_test_flags both read global memory,
so can't be const. They only seem to write for the purpose of a lock, which
they undo at the end, so maybe we can get away with G_GNUC_PURE here.

Bug: https://gitlab.gnome.org/GNOME/glib/-/work_items/3984
Signed-off-by: Sam James <sam@gentoo.org>
2026-06-25 17:59:14 +01:00
Sam James
945953ed03 Drop G_GNUC_CONST for *_get_type
g_type_ensure has a large comment saying _get_type shouldn't be
marked with G_GNUC_CONST because it has side-effects on the first
run, but it's OK if you consistently call g_type_ensure first.

Unfortunately, this isn't accurate. GCC trunk (observed at r17-1725-ge259a182e1f100)
now analyses points-to information more effectively and propagates its
findings, so it sees the function modifies some global state, concludes
that can't be possible (because of the const attribute), and deletes
the stores.

pure unfortunately is unsuitable for *_get_type too as it has a side-effect
(writes to global memory).

Mesa had a similar issue which I fixed recently [0]. glib and glibmm likely
want the (not-yet-implemented) 'idempotent' attribute instead [1]. In fact,
this exact problem is what motivated that request! :)

ebassi mentions an alternative to the current setup as well, using
atomics [2].

This problem has gone back many years but the compiler has finally
fully outsmarted us here, so give in.

[0] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42361
[1] https://gcc.gnu.org/PR32911
[2] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4249#note_2583110

Fixes: https://gitlab.gnome.org/GNOME/glib/-/work_items/3984
Signed-off-by: Sam James <sam@gentoo.org>
2026-06-25 17:59:14 +01:00
Philip Withnall
07233788db 2.88.2
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.88.2
2026-06-25 14:35:18 +01:00
Philip Withnall
7d48695aa0 Merge branch 'update-translation-pl-from-glib-2-88-1d69d616-6f25-11f1-9b17-0a580a8203f9' into 'glib-2-88'
Update Polish translation

See merge request GNOME/glib!5220
2026-06-23 17:55:14 +00:00
Victoria Niedzielska
34cc51a754 Update Polish translation 2026-06-23 17:01:06 +00:00
Philip Withnall
5c677bc18d Merge branch 'update-translation-it-from-glib-2-88-544d7dee-63d7-11f1-9b63-0a580a800681' into 'glib-2-88'
Update Italian translation

See merge request GNOME/glib!5208
2026-06-23 15:03:24 +00:00
Davide Ferracin
37e289e8ee Update Italian translation 2026-06-23 14:39:26 +00:00
Philip Withnall
c6e054e3e5 Merge branch 'backport-5209-mingw32-ci-fixes-glib-2-88' into 'glib-2-88'
Backport !5209 “CI: set msys2-clang64 as default job for merges” to glib-2-88

See merge request GNOME/glib!5219
2026-06-23 14:39:02 +00:00
Luca Bacci
e38e4d5265 GDBusConnection: Copy entire vtables to avoid -Walloc-size warnings
We now include padding entries in copied vtables
2026-06-23 15:16:29 +01:00
Simon McVittie
934d12d17c gvariant: Match allocation size of g_slice_new to g_slice_free
Commit ebbeb318 "gvariant: Tweak GVariantIter heap allocation size"
changed the code path that allocates iterators on the heap to use
the full size of the public iterator struct (including padding),
but didn't change the matching g_slice_free() call. g_slice_free() is
implemented as basically g_free_sized(), so the size passed to it
should match the size that was allocated.

Fixes: ebbeb318 "gvariant: Tweak GVariantIter heap allocation size"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2026-06-23 15:13:50 +01:00
Philip Withnall
2dddd64349 gvariant: Tweak GVariantIter heap allocation size
This re-works commit 608b846f38, because
it didn’t actually fix the warning on msys2-clang64.

Rather than go through contortions to try and squash that warning, just
allocate the full size struct instead. If people are worried about the
allocation size here, they really should already be using a stack
allocated GVariantIter instead.

Fixes CI failure https://gitlab.gnome.org/GNOME/glib/-/jobs/6444549.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-06-23 15:13:38 +01:00
Philip Withnall
cfbc1bf2c6 gvariant: Tweak GVariantIter heap allocation casting
For reasons unknown to me, the public `GVariantIter` struct is declared
as being 16 pointers in size, but the private internal implementation of
it, `struct heap_iter`, is smaller (10 pointers).

Internally, the `GVariantIter` code casts iters around between
`GVariantIter`, `struct heap_iter` and `struct stack_iter` (which is
smaller still) quite merrily — presumably with appropriate magic checks
in place because we’ve never had a bug report about it.

However, allocating `struct heap_iter` (10 pointers) and immediately
casting it to `GVariantIter` (16 pointers) is now triggering a new
`-Walloc-size` warning in clang 22, which is fair enough.

Because C is serious about type safety, let’s go through some
contortions to squash that warning while continuing to do weird and
inadvisable things.

Diagnosed by Luca Bacci in
https://gitlab.gnome.org/GNOME/glib/-/issues/3922#note_2722553; fixes CI
failure https://gitlab.gnome.org/GNOME/glib/-/jobs/6360619:
```
FAILED: [code=1] glib/libglib-2.0-0.dll.p/gvariant.c.obj
"C:\msys64\clang64\bin/ccache.EXE" "cc" "-Iglib/libglib-2.0-0.dll.p" "-Iglib" "-I../glib" "-I." "-I.." "-fvisibility=hidden" "-fdiagnostics-color=always" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-Wextra" "-Wpedantic" "-Werror" "-std=gnu99" "-O0" "-g" "-D_GNU_SOURCE" "-DUNICODE" "-D_UNICODE" "-fno-strict-aliasing" "-DG_ENABLE_DEBUG" "-Wfloat-conversion" "-Wimplicit-fallthrough" "-Wmisleading-indentation" "-Wmissing-field-initializers" "-Wnonnull" "-Wnull-dereference" "-Wunused" "-Wno-unused-parameter" "-Wno-cast-function-type" "-Wno-pedantic" "-Wno-format-zero-length" "-Wno-variadic-macros" "-Werror=format=2" "-Werror=init-self" "-Werror=missing-include-dirs" "-Werror=pointer-arith" "-Werror=unused-result" "-Wstrict-prototypes" "-Wno-bad-function-cast" "-Werror=implicit-function-declaration" "-Werror=missing-prototypes" "-Werror=pointer-sign" "-Wno-string-plus-int" "-Wno-typedef-redefinition" "-mms-bitfields" "-DG_LOG_DOMAIN=\"GLib\"" "-DGLIB_COMPILATION" "-DPCRE2_STATIC" -MD -MQ glib/libglib-2.0-0.dll.p/gvariant.c.obj -MF "glib/libglib-2.0-0.dll.p/gvariant.c.obj.d" -o glib/libglib-2.0-0.dll.p/gvariant.c.obj "-c" ../glib/gvariant.c
../glib/gvariant.c:2992:27: error: allocation of insufficient size '80' for type 'GVariantIter' (aka 'struct _GVariantIter') with size '128' [-Werror,-Walloc-size]
 2992 |   iter = (GVariantIter *) g_slice_new (struct heap_iter);
      |                           ^
../glib/gslice.h:56:33: note: expanded from macro 'g_slice_new'
   56 | #define  g_slice_new(type)      ((type*) g_slice_alloc (g_slice_alloc_size (type)))
      |                                 ^
1 error generated.
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-06-23 15:13:31 +01:00
Luca Bacci
f72ddad8ac CI: Fix msys2-mingw32 after upstream packages removal
MSYS2 has removed libelf from the MINGW32 repo [1] [2].
We expect that more packages will be dropped since the
MINGW32 environment is deprecated.

Let's install the bare minimum and use meson subprojects to
build dependencies.

References:

1. https://www.msys2.org/news/#2023-12-13-starting-to-drop-some-32-bit-packages
2. https://github.com/msys2/MINGW-packages/commit/1edc149ba5
2026-06-23 14:56:47 +01:00
Luca Bacci
775d32e995 CI: set msys2-clang64 as default job for merges
...and thus for generating coverage data, GIR data, and docs.

At the same time we set msys2-mingw32 as weekly-schedule or
manual.

MSYS2 has deprecated the MINGW32 environment since quite some:
https://www.msys2.org/news/#2023-12-13-starting-to-drop-some-32-bit-packages

(Backport 2.88: Minor cherry pick conflict fixes in
supported-platforms.md)
2026-06-23 14:56:28 +01:00
Philip Withnall
2e230828cd Merge branch 'update-translation-eu-from-glib-2-88-a985fabe-60b9-11f1-b31d-0a580a81043f' into 'glib-2-88'
Update Basque translation

See merge request GNOME/glib!5203
2026-06-07 20:17:26 +00:00
Asier Saratsua Garmendia
05291059e2 Update Basque translation 2026-06-05 08:36:42 +00:00
Philip Withnall
4f97f9e180 Merge branch 'update-translation-de-from-glib-2-88-ac7926e2-47eb-11f1-8c6f-0a580a820527' into 'glib-2-88'
Update German translation

See merge request GNOME/glib!5179
2026-05-06 16:49:53 +00:00
Philip Withnall
aef99c4c7f Merge branch 'update-translation-th-from-glib-2-88-6e93a446-4896-11f1-85c4-0a580a80062d' into 'glib-2-88'
Update Thai translation

See merge request GNOME/glib!5181
2026-05-06 16:40:45 +00:00
Jürgen Benvenuti
ee6077b178 Update German translation 2026-05-06 16:26:42 +00:00
Aefgh Threenine
b58d72ff3a Update Thai translation 2026-05-06 16:26:39 +00:00
Marco Trevisan
e414d40e00 Merge branch 'backport-5176-gnulib-flags-fix-glib-2-88' into 'glib-2-88'
Backport !5176 “gnulib: Fix unused flags variable warning” to glib-2-88

See merge request GNOME/glib!5178
2026-05-06 18:21:30 +02:00
Philip Withnall
c440503e97 gnulib: Fix unused flags variable warning
The following error has just popped up in mingw32 CI, which presumably
means the compiler has just been upgraded under our feet again:
```
../glib/gnulib/vasnprintf.c: In function '_g_gnulib_vasnprintf':
../glib/gnulib/vasnprintf.c:2429:21: error: variable 'flags' set but not used [-Werror=unused-but-set-variable=]
 2429 |                 int flags = dp->flags;
      |                     ^~~~~
cc1.exe: all warnings being treated as errors
```

This highlighted a bug in the version of gnulib we’re using, where the
`flags` variable was assigned but never used.

In lieu of updating our gnulib copylib version (which I don’t have the
energy to do right now; see #2603), copy across the fix for this issue
from upstream.

It’s upstream commit 5527d5c548702b89d217bbe58036996066a709b6.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-05-04 12:40:51 +01:00
Philip Withnall
d43ba363cb 2.88.1
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.88.1
2026-05-02 13:26:52 +01:00
Philip Withnall
0a34f09768 Merge branch 'backport-5170-5171-5172-5173-security-fixes-glib-2-88' into 'glib-2-88'
Backport !5170 !5171 !5172 !5173 Various security fixes to glib-2-88

See merge request GNOME/glib!5174
2026-04-29 16:22:07 +00:00
Philip Withnall
0919301962 tests: Add a unit test for GDBusAuthMechanismSha1 cookie context parsing
This checks for regressions in the fixes from the previous few commits.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3931
2026-04-29 16:51:08 +01:00
Philip Withnall
060aea67de gdbusauthmechanism: Expose client reject reason as a new vfunc
We can do this because `gdbusauthmechanism.h` is a private header.

Hook it up to the existing `reject_reason` code in each
`GDBusAuthMechanism` implementation, as all three implementations
currently intermingle reject reasons from the server and client code, so
there would currently be no benefit to having a separate server and
client implementation of `*_get_reject_reason()`.

This new private API will be used in a new unit test in the following
commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-04-29 16:51:04 +01:00
Philip Withnall
c053112534 gdbusauthmechanismsha1: Improve validation of cookie ID
The D-Bus specification says the cookie ID has to be non-negative, but
we weren’t checking that (or checking that it was non-empty).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-04-29 16:50:59 +01:00
Philip Withnall
db9c8fae39 gdbusauthmechanismsha1: Validate cookie context
Without validation, the server could send a malicious context which
contains path traversal characters, allowing it to exfiltrate a SHA-1
hashed copy of arbitrary data from the client’s file system.

To exploit this successfully would require the client to choose to
connect peer-to-peer to a malicious D-Bus server and to choose the SHA-1
authentication mechanism in preference to all the other mechanisms. This
is vanishingly unlikely.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3931
2026-04-29 16:50:55 +01:00
Philip Withnall
e28262f169 gdbusmessage: Fix types of integer arithmetic in message length calculation
This fixes the addition happening with type `uint32_t`, rather than the
expected `gssize`. Because of the narrower type, this could have
resulted in integer overflow for large header lengths, bypassing the
message length check lower down in the function.

This is not exploitable in practice unless communicating peer-to-peer
with a malicious D-Bus peer, as invalid messages like this would be
filtered out by the message bus (such as `dbus-daemon`).

Rework the arithmetic to use checked arithmetic functions into a
`size_t` (largely as suggested by Simon McVittie), and add some unit
tests. Simply doing the arithmetic in the `gssize` domain would not fix
the issue on 32-bit systems.

Based on a report by Koda Reef, albeit reverse engineered as the report
did not contain a proof of concept of the vulnerability.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3933
2026-04-29 16:49:21 +01:00
Philip Withnall
94ecb5b44a gkeyfile: Fix a one-byte heap under-read with g_key_file_get_locale_string_list()
If this method was called on a key file key which has an empty value,
`len == 0` and this leads to a one-byte under-read off the start of the
key file buffer.

Spotted by linhlhq as #YWH-PGM9867-200. The suggested fix is theirs, and
the unit test is adapted from their report. I added the fuzzing test.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3930
2026-04-29 16:48:54 +01:00
Philip Withnall
6a2583dec3 giochannel: Fix memcmp() off the end of the buffer with long terminators
If the line terminator is longer than a single byte, and the current
line extends to the end of the buffer, and the buffer (which is a
`GString`) is near a power of two in length (as that’s how `GString`s
are allocated) it’s possible for the `memcmp()` which checks the
terminator to read off the end of the string buffer.

Fix that by checking the terminator length against the last character
before calling `memcmp()`. Add a unit test.

Spotted by linhlhq as #YWH-PGM9867-199. The fix is theirs (validated by
me), and the unit test is adapted from their proof of concept.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3925
2026-04-29 16:48:40 +01:00
Philip Withnall
c50886d9ff Merge branch 'update-translation-fa-from-glib-2-88-e9244de2-4296-11f1-bb66-0a580a8205a4' into 'glib-2-88'
Update Persian translation

See merge request GNOME/glib!5169
2026-04-28 12:26:04 +00:00
Danial Behzadi
7f05b18770 Update Persian translation 2026-04-28 00:12:23 +00:00
Philip Withnall
14497c9058 Merge branch 'update-translation-sk-from-glib-2-88-4d654d24-4229-11f1-919b-0a580a8205a4' into 'glib-2-88'
Update Slovak translation

See merge request GNOME/glib!5166
2026-04-27 11:59:41 +00:00
Jose Riha
3acb2702bd Update Slovak translation 2026-04-27 11:08:44 +00:00