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

32911 Commits

Author SHA1 Message Date
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
Philip Withnall
337d9478d2 Merge branch 'update-translation-sk-from-glib-2-88-a2645410-3f53-11f1-bc7c-0a580a8205a4' into 'glib-2-88'
Update Slovak translation

See merge request GNOME/glib!5165
2026-04-24 13:44:07 +00:00
Jose Riha
0ab45d593c Update Slovak translation 2026-04-23 20:33:29 +00:00
Emmanuele Bassi
648c7ec589 Merge branch 'backport-5145-variant-type-pure-glib-2-88' into 'glib-2-88'
Backport !5145 “gvarianttype: use pure attribute, not inappropriate const” to glib-2-88

See merge request GNOME/glib!5150
2026-04-20 14:31:52 +01:00
Philip Withnall
123c6a0631 Merge branch 'update-translation-de-from-glib-2-88-932f554e-3aa3-11f1-a62e-0a580a800620' into 'glib-2-88'
Update German translation

See merge request GNOME/glib!5154
2026-04-18 06:21:49 +00:00
Christian Kirbach
3c9b65d6a3 Update German translation 2026-04-17 21:22:54 +00:00
Philip Withnall
d31a95dc48 Merge branch 'update-translation-sk-from-glib-2-88-e28c9808-37c0-11f1-a943-0a580a800608' into 'glib-2-88'
Update Slovak translation

See merge request GNOME/glib!5152
2026-04-16 12:40:37 +00:00
Jose Riha
29afc435b1 Update Slovak translation 2026-04-14 05:15:12 +00:00
Sam James
5b792f73cb gvarianttype: use pure attribute, not inappropriate const
As found in https://gcc.gnu.org/PR124837, it is wrong to use the const
attribute [0] for g_variant_type_*is* because it may be called repeatedly
with different pointed-to data. The pure attribute [1] is what we want
here because it allows pointed-to data to change, so change to that.

const would be OK here if it pointed to a constant buffer, but it doesn't,
it points to newly malloc'd memory from all over the place.

[0] https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Common-Function-Attributes.html#index-const-function-attribute
[1] https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Common-Function-Attributes.html#index-pure-function-attribute

Fixes: 49bfa7b9cf
Signed-off-by: Sam James <sam@gentoo.org>
2026-04-11 13:41:23 +01:00
Philip Withnall
1c6df95583 Merge branch 'backport-5129-5130-5131-5132-5133-security-fixes-glib-2-88' into 'glib-2-88'
Backport various recent security fixes to GVariant, GMarkup, GDateTime and GRegex to glib-2-88

See merge request GNOME/glib!5134
2026-04-02 17:44:44 +00:00
Philip Withnall
704dae66a2 gregex: Rename the compile_opts members to clarify their types
It’s easy to confuse `compile_opts` (`PCRE2_*` flags) and
`orig_compile_opts` (`GRegexCompileFlags` flags). Rename them to
`pcre2_compile_opts` and `regex_compile_opts`, respectively, to make it
a bit less confusing.

Unfortunately the type checker can’t help us here as the `PCRE2_*` flags
are defined by `pcre2` using `#define`s rather than an `enum`, so
`pcre2_compile_opts` has to stay as a `uint32_t` rather than a more
specific type.

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

Helps: #3919
2026-04-02 17:53:39 +01:00
Philip Withnall
3815dd0079 gregex: Fix use of wrong option flags set for checking for G_REGEX_RAW
`GRegex.compile_opts` contains the options using PCRE2’s flags;
`GRegex.orig_compile_opts` contains them in `GRegexCompileFlags` format,
and that’s what we want here.

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

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

Fixes: #3919
2026-04-02 17:48:31 +01:00
Philip Withnall
e680a53224 gregex: Fix case changing substitutions with G_REGEX_RAW
In `G_REGEX_RAW` mode, the input string is treated as a byte array
(basically ASCII) rather than a unichar array. Accordingly, the case
changing code for substitutions needs to operate on bytes with
`G_REGEX_RAW`, rather than operating on unichars.

This fixes a potential buffer overflow when trying to do a case change
on a match of a set of bytes which are a truncated multi-byte UTF-8
encoding at the end of the input buffer.

Spotted by linhlhq as #YWH-PGM9867-193. I adapted their reproducer as
the unit test, but implemented the fix in `gregex.c` independently.

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

Fixes: #3918
2026-04-02 17:48:24 +01:00
Philip Withnall
5627b37638 gdatetime: Add missing range validation to g_date_time_add_full()
Otherwise it’s possible to create a non-`NULL` but invalid `GDateTime`,
which breaks all kinds of internal assumptions.

Spotted by linhlhq as #YWH-PGM9867-191. Thanks to them for providing a
suggested fix and a test case, which I have adapted and validated.

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

Fixes: #3917
2026-04-02 17:48:00 +01:00
Philip Withnall
3f6436dd13 gdatetime: Factor out a couple of magic constants
This introduces no functional changes, it just makes the code a little
clearer.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-04-02 17:47:53 +01:00
Philip Withnall
1275e9ecdf gmarkup: Fix potential one-byte overread in g_markup_escape_text()
If the input string (which might be malicious, as the program is
choosing to escape it) ends with 0xc2 (a UTF-8 prefix byte), the code
wasn’t previously checking the input string length was long enough to
contain the following byte before reading it.

Fix that by switching from `g_utf8_get_char()` to
`g_utf8_get_char_validated()`.

Spotted by linhlhq as #YWH-PGM9867-187. Thank you for the suggested fix
and unit test, which have been adapted into this commit.

Also spotted by oss-fuzz after we added a fuzz test for this function.

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

Fixes: #3916
oss-fuzz#498475244
2026-04-02 17:47:18 +01:00
Philip Withnall
be85f9429b gvariant: Fix an off-by-one error in an offset comparison
This allows a single byte out-of-bounds read off the end of the
(potentially untrusted) byte array backing a `GVariant` when it’s
being checked for normal form.

I can’t see how this could practically be exploited, but it’s certainly
a security bug as the `GVariant` normal form checking code is supposed
to be robust to malicious inputs.

Spotted by linhlhq as #YWH-PGM9867-190, and fix and reproducer provided
by them too, thanks. Confirmed and turned into a unit test by me.

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

Fixes: #3915
2026-04-02 17:47:11 +01:00
Philip Withnall
2d2c1758a1 Merge branch 'update-translation-sk-from-glib-2-88-d686ddf8-2c89-11f1-b520-0a580a8007cf' into 'glib-2-88'
Update Slovak translation

See merge request GNOME/glib!5122
2026-03-30 23:51:56 +00:00