26041 Commits

Author SHA1 Message Date
Philip Withnall
b5299ed205
2.74.2
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2.74.2
2022-11-24 12:29:05 +00:00
Emmanuele Bassi
7908532046 Merge branch 'backport-3061-variant-maybe-wrapper-speedup-glib-2-74' into 'glib-2-74'
Backport !3061 “gvariant-parser: Speed up maybe_wrapper() by an order of magnitude” to glib-2-74

See merge request GNOME/glib!3063
2022-11-24 11:33:56 +00:00
Marco Trevisan
c7aa6e3bf4 Merge branch 'backport-3082-str-equal-api-break-glib-2-74' into 'glib-2-74'
Backport !3082 “gstrfuncs: Fix regression in types accepted by g_str_equal()” to glib-2-74

See merge request GNOME/glib!3084
2022-11-22 17:10:08 +00:00
Philip Withnall
b46ed37c97 gstrfuncs: Fix regression in types accepted by g_str_equal()
The new macro form of `g_str_equal()` had stricter type checking than
the original function form. That would be nice, except it causes new
compiler warnings in third party projects, which counts as an API break
for us, so unfortunately we can’t do it.

Add some tests to prevent regressions on this again.

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

Fixes: #2809
2022-11-22 16:14:51 +00:00
Мирослав Николић
25df888507 Update Serbian translation 2022-11-20 14:27:19 +00:00
Philip Withnall
64c2f5f3bb gvariant-parser: Speed up maybe_wrapper() by an order of magnitude
This further helps with the potential denial of service problem in
issue #2782 / oss-fuzz#49462 / oss-fuzz#20177.

Instead of allocating a new `GVariant` for each nesting level of
maybe-types, allocate a single `GVariant` and give it the fully-nested
maybe type as its type. This has to be done in serialised form.

This prevents attackers from triggering O(size of container × typedecl
depth) allocations.

This is a follow up to commit 3e313438f1900a620485ba88aad64c4e857f6ad1,
and includes a test.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2782
oss-fuzz#20177
oss-fuzz#49462
2022-11-08 17:12:40 +00:00
Nathan Follens
5ee5900459 Update Dutch translation 2022-11-02 19:09:03 +00:00
Ray Strode
fcdf5ebd81 Merge branch 'open-pipe-revert-2-74-backport' into 'glib-2-74'
Backport !3029 “Revert "Handling collision between standard i/o file descriptors and newly created ones" ” to glib-2-74

See merge request GNOME/glib!3039
2022-11-02 16:08:00 +00:00
Ray Strode
1c1c452ff2 glib-unix: Add test to make sure g_unix_open_pipe will intrude standard range
Now that we know it's a bad idea to avoid the standard io fd range
when getting pipe fds for g_unix_open_pipe, we should test to make sure
we don't inadvertently try to do it again.

This commit adds that test.
2022-11-02 09:26:47 -04:00
Ray Strode
2a36bb4b7e Revert "Handling collision between standard i/o file descriptors and newly created ones"
g_unix_open_pipe tries to avoid the standard io fd range
when getting pipe fds. This turns out to be a bad idea because
certain buggy programs rely on it using that range.

This reverts commit d9ba6150909818beb05573f54f26232063492c5b

Closes: #2795
Reopens: #16
2022-11-02 09:26:45 -04:00
Michael Catanzaro
6870d08d4b Merge branch 'backport-3045-proxy-resolver-tagging-glib-2-74' into 'glib-2-74'
Backport !3045 “gproxyresolver: lookup_finish() should better parallel lookup_async()” to glib-2-74

See merge request GNOME/glib!3046
2022-11-02 13:06:43 +00:00
Michael Catanzaro
299812d5ec gproxyresolver: lookup_finish() should better parallel lookup_async()
In g_proxy_resolver_lookup_async() we have some error validation that
detects invalid URIs and directly returns an error, bypassing the
interface's lookup_async() function. This is great, but when the
interface's lookup_finish() function gets called later, it may assert
that the source tag of the GTask matches the interface's lookup_async()
function, which will not be the case.

As suggested by Philip, we need to check for this situation in
g_proxy_resolver_lookup_finish() and avoid calling into the interface
here if we did the same in g_proxy_resolver_lookup_async(). This can be
done by checking the source tag.

I added a few new tests to check the invalid URI "asdf" used in the
issue report. The final case, using async GProxyResolver directly,
checks for this bug.

Fixes #2799
2022-11-02 09:49:57 +00:00
Simon McVittie
05fdb2d049 Merge branch 'backport-3035-portal-header-guard-glib-2-74' into 'glib-2-74'
Backport !3035 “portal: Fix broken header guard” to glib-2-74

See merge request GNOME/glib!3038
2022-11-02 02:01:03 +00:00
Robert Ancell
1304f9ed92 portal: Fix broken header guard
This wouldn't have caused an issue with the current header contents, but could have triggered a future bug.
2022-10-31 12:32:22 +00:00
Nart Tlisha
681980d382 Update Abkhazian translation 2022-10-31 10:03:40 +00:00
Marco Trevisan
a1151bc166 Merge branch 'backport-3008-wrapped-argv-leak-glib-2-74' into 'glib-2-74'
Backport !3008 “gio/gdesktopappinfo: Free the wrapped argv array on launch failure” to glib-2-74

See merge request GNOME/glib!3017
2022-10-26 11:47:08 +00:00
Marco Trevisan (Treviño)
efb43ef813 gio/gdesktopappinfo: Free the wrapped argv array on launch failure
We create an array that we never free, ensure this is the case.
The previous commit gives CI a chance to check this with valgrind job.

Found as part of another review:
 - https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2839#note_1524922
2022-10-26 10:30:09 +01:00
Philip Withnall
058491cb6f 2.74.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2.74.1
2022-10-25 13:53:22 +01:00
Philip Withnall
8fa92cf69b Merge branch 'backport-3009-timezone-relative-link-target-glib-2-74' into 'glib-2-74'
Backport !3009 “gtimezone: Fix symlink checks on relative link targets” to glib-2-74

See merge request GNOME/glib!3010
2022-10-25 12:23:15 +00:00
Fabio Tomat
142f1712d2 Update Friulian translation 2022-10-25 11:43:10 +00:00
Philip Withnall
14d5f25dd0 gfileutils: Mention possibility of relative paths in g_file_read_link()
It’s entirely possible that `g_file_read_link()` will return a relative
path. Mention that in the documentation, and include a short example of
how to make the path absolute for further computation.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-24 13:12:57 +01:00
Philip Withnall
0768067155 gtimezone: Fix symlink checks on relative link targets
The changes in 6265b2e6f70d6f0ec4d16adcdc5f7c53aecf0da4 to reject weird
`/etc/localtime` configurations where `/etc/localtime` links to another
symlink did not consider the case where the target of `/etc/localtime`
is a *relative* path. They only considered the case where the target is
absolute.

Relative paths are permissible in all symlinks. On my Fedora 36 system,
`/etc/localtime`’s target is `../usr/share/zoneinfo/Europe/London`.

Fix the check for toolbx by resolving relative paths before calling
`g_lstat()` on them.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-24 13:12:57 +01:00
Marco Trevisan
abac659264 Merge branch 'backport-2952-win32-test-fixes-glib-2-74' into 'glib-2-74'
Backport !2952 “Various win32 test fixes” to glib-2-74

See merge request GNOME/glib!2958
2022-10-21 16:02:36 +00:00
Marco Trevisan
957679f024 Merge branch 'backport-2947-gspawn-eintr-glib-2-74' into 'glib-2-74'
Backport !2947 “gspawn: avoid race due to retry with EINTR on close()” to glib-2-74

See merge request GNOME/glib!2988
2022-10-21 15:59:59 +00:00
Emmanuele Bassi
0e12b7d662 Merge branch 'backport-2934-floating-variants-grr-glib-2-74' into 'glib-2-74'
Backport !2934 “gobject: Always ref-sink variants in g_object_set” to glib-2-74

See merge request GNOME/glib!2998
2022-10-21 15:20:56 +00:00
Thomas Haller
7720c598f4 gspawn: use g_close()
g_close() now is async-signal-safe, as long as we don't request a GError
and pass a valid file descriptor.

Update "gspawn.c" to drop its safe_close() function and use
g_close() instead.
2022-10-21 15:38:27 +01:00
Thomas Haller
0cfc5b054a gstdio: make g_close() async-signal-safe under certain conditions
g_close() does something useful. It is not trivial to get EINTR handling of
close() right, in a portable manner. g_close() abstracts this.

We should allow glib users to use the function even in async-signal-safe
contexts, at least if the user heeds the caveat about GError and take care
not to fail assertions.

Backport 2.74: Modified to drop documentation changes to g_close() which
document its new async-signal-safe guarantees. They are not public
guarantees until 2.76. Also modified to include moving the code to
ignore `EINTR` from commit d5dc7d266f2b8d0f7d.
2022-10-21 15:37:33 +01:00
Matthias Clasen
fa8ca6e739 gobject: Always ref-sink variants in g_object_set
When collecting varargs, ignore the NOCOPY_CONTENTS
flag for variants. That is what our docs advice for
refcounted types, and it fixes a regression that
was inadvertendly introduced when we stopped doing
some extra GValue copies.

Includes a test case by Philip Withnall.

Fixes: #2774
2022-10-21 14:27:30 +01:00
Philip Withnall
ccc5dec3c0 Merge branch 'revert-2852-gobject-warnings-glib-2-74' into 'glib-2-74'
Revert "Replace most GObject warnings with criticals" on glib-2-74

See merge request GNOME/glib!2996
2022-10-21 13:09:43 +00:00
Philip Withnall
d38268c086 Merge branch 'wip/smcv/revert-2924' into 'glib-2-74'
Revert !2924 in 2.74.x branch

See merge request GNOME/glib!2995
2022-10-21 12:02:25 +00:00
Philip Withnall
b89e825cc1 Revert "Replace most GObject warnings with criticals"
This reverts commit 0ffe86a1f7e215e4561c3b9f1d03c3cd638ed00f.

This was intended to land for the 2.75.x unstable series, and not in the
2.74.x stable series.

Fixes: #2788
2022-10-21 12:51:00 +01:00
Simon McVittie
53178b084c Revert "Optimize g_double_hash implementation"
This reverts commit dd1f4f709ea8cad1a1d6184ee0883be128fb81d8.
which caused a regression on big-endian architectures (all doubles would
hash to zero).

Partially resolves #2787

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-21 10:25:13 +01:00
Simon McVittie
c8e9eaf9a3 Revert "Optional optimization for g_int64_hash"
This reverts commit c1af4b2b886bd77d6d8857cf3f677edbc0d34a61,
which caused a regression on big-endian architectures (all 64-bit
integers would hash to zero).

Partially resolves #2787

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-21 10:25:10 +01:00
Simon McVittie
f889275a28 Revert "Add tests for hash collisions in simple cases"
This reverts commit e02db8ea22d545749ecaf3be9d342cc565bc143a.
We can't guarantee a lack of hash collisions if we go back to the 2.74.0
hashing implementation.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-21 10:25:07 +01:00
Marco Trevisan
f147c5eed1 Merge branch 'wip/pwithnall/backport-2978-osx-test-fixes-glib-2-74' into 'glib-2-74'
Backport !2978 “A couple of test fixes on OS X” to glib-2-74

See merge request GNOME/glib!2989
2022-10-20 16:26:10 +00:00
Ray Strode
428f6421fb tests: Check for public.text not text/plain on OSX
The "content type" on OSX is a Uniform Type Identifier not a MIME
type, so make sure to use the right format in the empty file test.
2022-10-20 13:53:09 +01:00
Ray Strode
6c7a242e37 tests: Don't run du on osx
The du command that ships on OS X doesn't understand
--bytes, so don't try to use du on that platform.
2022-10-20 13:53:09 +01:00
Thomas Haller
f0bcb7f79c gspawn: avoid race due to retry with EINTR on close()
Retry on EINTR is wrong on many OS, including Linux. See the comment
in g_close() why that is.

As we cannot use g_close() after fork, we had safe_close(). This had the
wrong retry loop on EINTR. Drop that.

This was especially problematic since commit 6f46294227f8 ('gspawn: Don’t
use g_close() in async-signal-safe context'). Before, safe_close() was
only called after fork, where there is only one thread and there is no
concern about a race.

This patch only exists for easier backporting of the bugfix. The code
will be reworked further next.

Fixes: 6f46294227f8 ('gspawn: Don’t use g_close() in async-signal-safe context')
2022-10-20 13:42:23 +01:00
Marco Trevisan
1936516268 Merge branch 'backport-2910-fputs-result-glib-2-74' into 'glib-2-74'
Backport !2910 “gmessages: Handle unused results from fputs and fwrite” to glib-2-74

See merge request GNOME/glib!2983
2022-10-19 15:30:06 +00:00
Marco Trevisan
23fff2024b Merge branch 'backport-2887-content-type-sniffing-glib-2-74' into 'glib-2-74'
Backport !2887 “glocalfileinfo: Ensure we always sniff some data to get the content type” to glib-2-74

See merge request GNOME/glib!2982
2022-10-19 15:25:23 +00:00
Marco Trevisan (Treviño)
07509cace9 gmessages: Handle unused results from fputs and fwrite
Fixes: #2758
2022-10-19 10:29:12 +01:00
Marco Trevisan (Treviño)
3057273816 glocalfileinfo: Ensure we always sniff some data to get the content type
In case the XDG database is not initialized yet we may try to sniff a
0-length data, making our content-type routines to mark non-empty files
as `application/x-zerosize`.

This is wrong, so in case the sniff size is not set, let's just
try to read the default value. To avoid false-application/x-zerosize
results (that are not something we want as per legacy assumptions).

See: https://bugzilla.gnome.org/show_bug.cgi?id=755795

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2742
2022-10-19 10:11:43 +01:00
Marco Trevisan
d0b81a8bfd Merge branch 'backport-2959-leak-fixes-glib-2-74' into 'glib-2-74'
Backport !2959 “Some leaks fixes” to glib-2-74

See merge request GNOME/glib!2960
2022-10-18 15:32:44 +00:00
Marco Trevisan
4ea5bac34a Merge branch 'backport-2955-timezone-toolbox-glib-2-74' into 'glib-2-74'
Backport !2955 “gtimezone: Reject weird /etc/localtime configurations” to glib-2-74

See merge request GNOME/glib!2973
2022-10-18 14:51:13 +00:00
Philip Withnall
d3ecfdf1a1 Merge branch 'backport-2782-gvariant-recursion-typedecl-fix-glib-2-74' into 'glib-2-74'
Backport !2974 “gvariant-parser: Reject deeply-nested typedecls in text form variants” to glib-2-74

See merge request GNOME/glib!2975
2022-10-18 14:33:51 +00:00
Philip Withnall
777606419d gvariant-parser: Reject deeply-nested typedecls in text form variants
Return `G_VARIANT_PARSE_ERROR_RECURSION` from `g_variant_parse()` if a
typedecl is found within a text-form variant which would cause any part
of the variant to exceed the maximum allowed recursion/nesting depth.

This fixes an oversight when `G_VARIANT_MAX_RECURSION_DEPTH` was
implemented, which allowed typedecls to effectively multiply the size of
an array if `g_variant_parse()` was parsing a text-form variant without
a top-level concrete type specified.

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

Fixes: #2782
oss-fuzz#49462
2022-10-18 14:53:02 +01:00
Ray Strode
1143a8a666 gtimezone: Reject weird /etc/localtime configurations
At the moment, glib assumes that if /etc/localtime is a symlink,
that it's a symlink to zoneinfo file.

Toolbx containers add an extra layer of indirection though, making
it a symlink to a symlink to a zoneinfo file.

This commit deals with the problem, by performing additional checks
on /etc/localtime and ignoring it if those check fail, falling back
instead to reading /etc/timezone.
2022-10-18 14:43:21 +01:00
Marc-André Lureau
8c9769605f tests/gmenumodel: fix various leaks
Found thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:52:18 +01:00
Marc-André Lureau
fd68558eec tests/gobject-query.py: make it work on msys2/win32
For unclear reasons, universal_newlines=True doesn't seem to set the
text encoding correctly. Even if I set only encoding='utf-8', the test
fails. The combination here works for me, \o/.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
bbe3670224 tests/gobject-query: it is not a script (anymore?)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00