Commit Graph

24464 Commits

Author SHA1 Message Date
Luca Bacci
ebddb60e3e
Add vfunc checks in gappinfo.c
Fixes crashes caused by calling unimplemented vfuncs on Windows
2021-11-24 15:06:46 +01:00
Philip Withnall
dc243a5113 tests: Allow objcopy --help to fail, because it fails on FreeBSD
This is a partial revert of b248f3481c. Eventually, this commit can be
dropped once `objcopy --help` doesn’t exit with a non-zero status on
FreeBSD.

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2360#note_1318608

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-24 12:01:39 +00:00
Philip Withnall
f496d28093 Merge branch 'make_setprgname_thread_safe' into 'main'
gutils: Make g_set_prgname() thread-safe

Closes #847

See merge request GNOME/glib!2358
2021-11-24 11:10:29 +00:00
Nishal Kulkarni
ef4b43ff13 gutils: Make g_set_prgname() thread-safe
Currently `g_prgname` can be freed by `g_set_prgname()` while another
thread is holding a pointer to it.

We use GQuark when setting g_prgname so that string is never released once set.
Also added unit test, which checks if setting prgname in multi-threaded
program is safe.

Closes: #847
2021-11-24 16:22:28 +05:30
Philip Withnall
6bdb06ff4b Merge branch 'run_command-check' into 'main'
meson: specify when commands need to succeed in run_command

See merge request GNOME/glib!2360
2021-11-24 10:31:41 +00:00
Sebastian Dröge
6ec18d8254 Merge branch 'fix-clang-format' into 'main'
ci: Upgrade to clang-format-11 from clang-format-7

See merge request GNOME/glib!2357
2021-11-24 10:25:06 +00:00
Philip Withnall
23940e4707 Merge branch 'dbusproxy-signal-detailed' into 'main'
gdbusproxy: Make 'g-signal' signal detailed

Closes #2536

See merge request GNOME/glib!2350
2021-11-24 10:03:01 +00:00
Eli Schwartz
b248f3481c
meson: specify when commands need to succeed in run_command
meson in git master now warns about a missing `check:` kwarg, and may
eventually change the default from false to true.

Take the opportunity to require `objcopy --help` to succeed -- it is
unlikely to fail, but if it does something insane happened.
2021-11-24 00:31:18 -05:00
Hugo Carvalho
467bcacc56 Update Portuguese translation 2021-11-23 19:51:27 +00:00
Yuri Chornoivan
697d2c330e Update Ukrainian translation 2021-11-23 18:43:49 +00:00
Goran Vidović
ecb2bb736b Update Croatian translation 2021-11-23 18:34:49 +00:00
Aleksandr Mezin
bff4db527e gdbusproxy: Make 'g-signal' signal detailed
Fixes #2536
2021-11-23 22:14:19 +06:00
Philip Withnall
56b0b8069d Merge branch 'dbus-daemon-print-address-fd' into 'main'
gtestdbus: Print the dbus address on a specific FD intead of stdout

Closes #2537

See merge request GNOME/glib!2354
2021-11-23 13:32:24 +00:00
Philip Withnall
e6062056bc Merge branch '2528-dbus-message-truncation' into 'main'
gdbusmessage: Add more bounds checking when parsing D-Bus messages

Closes #2528

See merge request GNOME/glib!2355
2021-11-23 13:18:53 +00:00
Philip Withnall
93bde24c34 ci: Upgrade to clang-format-11 from clang-format-7
`clang-format-11` is now what’s available in our Debian Stable CI image.

This should fix failures in the `style-check-diff` job.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-23 13:13:56 +00:00
Marco Trevisan (Treviño)
d98a52254b gtestdbus: Print the dbus address on a specific FD intead of stdout
We used to use a pipe for the dbus daemon stdout to read the defined
address, but that was already requiring a workaround to ensure that dbus
daemon children were then able to write to stdout.
However the current implementation is still causing troubles in some
cases in which the daemon is very verbose, leading to hangs when writing
to stdout.

As per this, just don't handle stdout ourself, but use instead a
specific pipe to get the address address. That can now be safely closed
once we've received the data we need.

This reverts commit d80adeaa96.

Fixes: #2537
2021-11-23 13:07:50 +00:00
Philip Withnall
1f8390c002 gdbusmessage: Remove arbitrary restriction on minimum D-Bus blob length
The code in `g_dbus_message_new_from_blob()` has now been fixed to
correctly error out on all truncated messages, so there’s no need for an
arbitrary programmer error if the input is too short to contain a valid
D-Bus message header.

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

Helps: #2528
2021-11-23 12:57:29 +00:00
Sebastian Wilhelmi
c58be7d569 tests: Add test cases for truncated D-Bus messages
(Minor code formatting tweaks and leak fixes by Philip Withnall.)

Helps: #2528
2021-11-23 12:55:00 +00:00
Sebastian Wilhelmi
4b9a27a868 gdbusmessage: Add more bounds checking when parsing D-Bus messages
Perform strict bounds checking when reading data from the D-Bus message,
and propagate errors to the callers.

Previously, truncated D-Bus messages could cause out-of-bounds reads.

This is a security issue, but one which is only exploitable when
communicating with an untrusted peer (who might send malicious
messages). Almost all D-Bus traffic is with a session or system bus,
where the dbus-daemon or dbus-broker is trusted, and is known to have
already rejected malformed (malicious) messages.

Accordingly, this is only exploitable with peer-to-peer D-Bus
conversations with an untrusted peer.

(Includes some minor cleanups from Philip Withnall.)

oss-fuzz#17408
Fixes: #2528
2021-11-23 12:32:31 +00:00
Yuri Chornoivan
9aaaf719da Update Ukrainian translation 2021-11-23 07:47:07 +00:00
Fran Dieguez
5c3ebf3689 Update Galician translation 2021-11-22 21:31:37 +00:00
Goran Vidović
d37706f34a Update Croatian translation 2021-11-22 16:16:50 +00:00
Philip Withnall
b0923398f8 Merge branch 'mcatanzaro/gtlsdatabase-docs' into 'main'
Improve some documentation related to GTlsDatabase

See merge request GNOME/glib!2326
2021-11-22 16:09:14 +00:00
Michael Catanzaro
82999879bc gtlsconnection: warn about footguns of using a non-default database
Since
https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/173,
there is now a really surprising implication to using a non-default
GTlsDatabase: your database could do nothing at all other than wrap the
default database, which you would expect to result in no behavior
changes, but in fact it causes fewer security checks to be performed
during certificate verification. This is because certificate
verification moved from GTlsDatabase to GTlsConnection, allowing for
more security checks to be performed. But if using a non-default
GTlsDatabase, we have to fall back to letting GTlsDatabase to the
verification, as before.

This is the best we can do. It's not a regression for applications,
because it means applications get the previous pre-2.72 behavior. But it
does mean that new security checks added in 2.72 are not applied, which
is unfortunate, so we should warn developers about this.
2021-11-22 15:56:56 +00:00
Michael Catanzaro
a6a41cfc17 gtlscertificate: tone down warning about g_tls_certificate_verify() 2021-11-22 15:56:56 +00:00
Michael Catanzaro
5f585225a2 gtlsdatabase: tone down warning about g_tls_database_verify_chain()
This is only true for the default GnuTLS backend. It is not true for the
OpenSSL backend, so let's say "may" instead of "will."
2021-11-22 15:56:56 +00:00
Michael Catanzaro
3b3d56a45c gtlsdatabase: remove stray "Since: 2.70"
This feature has been reverted for now because I messed up the
implementation and it was doing sync I/O during async API calls. Oops!
Since it's not present in 2.70 nor in 2.72, let's remove the reference
to the exact GLib version that this behavior was introduced in. I'd like
to get it working properly for 2.74, but it's not ready yet and just
changing the version to 2.74 feels optimistic.
2021-11-22 15:56:56 +00:00
Sebastian Dröge
6d8045ddb4 Merge branch 'gdbus-call-interactive' into 'main'
gdbus: Add --interactive option to `gdbus call`

See merge request GNOME/glib!2329
2021-11-22 13:58:46 +00:00
Sebastian Dröge
84d02b1c86 Merge branch 'wip/pwithnall/test-converter-stream-fail' into 'main'
tests: Fix a flaky wait in converter-stream

See merge request GNOME/glib!2352
2021-11-22 13:57:29 +00:00
Sebastian Dröge
c3f4f9c215 Merge branch 'reformat-enums' into 'main'
tests: Reformat mkenums.py slightly to make run-black.sh happy

See merge request GNOME/glib!2342
2021-11-22 13:54:42 +00:00
Philip Withnall
8e185e12c9 tests: Fix a flaky wait in converter-stream
Rather than waiting for a fixed period of time, poll in a loop until the
condition the test is expecting is true.

A better solution would be to use a `GSource` and wait until that’s
dispatched. But doing so might affect the behaviour of the
`GInputStream` under test, so busy-wait instead.

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

```
(some socket debug output)
Bail out! GLib-GIO:ERROR:../gio/tests/converter-stream.c:1037:test_converter_pollable: assertion failed (res == -1): (1 == -1)
```

I could not reproduce the failure remotely with a few hundred
invocations of the test, so it might only present itself on BSD, which
presumably has different socket timing behaviour from Linux.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-22 13:22:25 +00:00
Philip Withnall
40037ebbfc tests: Use g_assert_*() rather than g_assert() in converter-stream.c
`g_assert()` is compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-22 13:20:17 +00:00
Philip Withnall
de2f692846 Merge branch 'main' into 'main'
gutf8: add string length check when ending character offset is -1

See merge request GNOME/glib!2328
2021-11-22 12:22:54 +00:00
Philip Withnall
fc05d08b39 Merge branch 'fix-timeout' into 'main'
gio/tests/codegen.py: bump timeout to 100 seconds

See merge request GNOME/glib!2348
2021-11-22 11:17:56 +00:00
Philip Withnall
d455ece99f Merge branch 'improve-win32-version' into 'main'
gutils.c: Improve g_get_os_info() for Windows 10/Server 2008 R2+

Closes #2443

See merge request GNOME/glib!2351
2021-11-22 11:16:04 +00:00
Philip Withnall
6d324cb081 Merge branch 'getenv-nullable' into 'main'
Annotate `g_getenv()` and `g_environ_getenv()` return value as `nullable`

See merge request GNOME/glib!2349
2021-11-22 10:52:11 +00:00
Chun-wei Fan
7540bed89e gutils.c: Improve g_get_os_info() for Windows Server 2008+
Instead of Windows 7/8/8.1 Server, use the proper names Server 2008
R2/2012/2012 R2 so that things are clearer to people.  Since nowadays
GLib requires Windows 7 (_WIN32_WINNT 0x0601, meaning the server
counterpart is Server 2008 R2), we include Server 2008 in the list for
completeness' sake, but exclude the Server 2003/2003R2 from the list.
2021-11-22 12:54:52 +08:00
Chun-wei Fan
5f56477cc7 gutils.c: Improve Windows Server 2016/10 20H2+ detection
This improves how we obtain the Windows release versions in
get_windows_version(), in turn g_get_os_info() for Windows Server 2016
and later, and Windows 10 20H2 (2009) and later and Windows 11, by doing
the following:

*  Check the build number.  For Windows 11, the build number is 22000+;
   for Windows Server 2022, the build number is 20348, and for Windows
   Server 2019, the build number is 17763.  We know what OS build
   numbers to check for by the Windows OS type that we obtained by using
   g_win32_check_windows_version().  Show the actual server release
   string (i.e. Windows Server 20xx yyyy) as appropriate, as a result.
*  Check the DisplayVersion entry in the registry under
   SOFTWARE\Microsoft\Windows NT\CurrentVersion if we obtained "2009"
   from the ReleaseId entry, since DisplayVersion replaces ReleaseId
   after Windows 10/Server 2019 20H2 (2009).  This makes things more
   clear for Windows releases after 20H2, where previously 20H2
   and 21H1 were all identified as Windows 10 [Server] 2009.

This should fix issue #2443.
2021-11-22 12:16:14 +08:00
Sebastian Dröge
07151049aa Annotate g_getenv() and g_environ_getenv() return value as nullable 2021-11-20 11:11:01 +02:00
Chun-wei Fan
045b4b80df gwin32.c: Split out call to RtlGetVersion()
Unfortunately, we may well be likely to need to call RtlGetVersion() via
GetModuleHandle() + GetProcAddress(), so split out the call to RtlGetVersion()
into a private function of its own, so that we can reuse the same code in other
parts of GLib, so that we can:

*  Determine better in a more fine-tuned way to determine whether we are on
   Windows 10/11 and/or Server 2016/2019/2022, since we need to rely on the
   build number.

*  Just call RtlGetVersion() once, when needed, as that is all that is needed.
   We could re-use the same function once to compare what we got when we
   called RtlGetVersion() and do what is necessary there.
2021-11-19 16:01:54 +08:00
Goran Vidović
674966bb6e Update Croatian translation 2021-11-18 18:42:52 +00:00
Chen Guanqiao
9adbdd45d7 gutf8: add string length check when ending character offset is -1
Some function such as atk_text_get_text, use -1 to indicate the end of the
string. And an crash occurs when the -1 is passed to g_utf8_substring.

Call Trace:
  0  __memmove_avx_unaligned_erms
  1  memcpy
  2  g_utf8_substring
  3  impl_GetText
  4  handle_other
  5  handle_message
  6  _dbus_object_tree_dispatch_and_unlock
  7  dbus_connection_dispatch
  8  dbus_connection_dispatch
  9  ()
  10 g_main_dispatch
  11 g_main_context_dispatch
  12 g_main_context_iterate
  13 g_main_context_iteration
  14 g_application_run
  15 main

Signed-off-by: Chen Guanqiao <chen.chenchacha@foxmail.com>
2021-11-19 00:52:07 +08:00
Emmanuele Bassi
3ec896b6f4 Merge branch 'wip/pwithnall/macos-werror' into 'main'
gutils: Disable some dead code on macOS

See merge request GNOME/glib!2345
2021-11-18 14:48:07 +00:00
Philip Withnall
b891266d69 ci: Enable --werror on macOS
There are no compiler warnings when building on macOS CI at the moment,
so let’s keep it that way by turning any future ones into errors.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Philip Withnall
97e3d366bc gosxutils: Add missing prototype
Fixes a `-Wmissing-prototypes` warning on macOS.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Philip Withnall
249e654b96 build: Pass warning and warning-disabling arguments to C++ and ObjC too
Previously they were only passed to the C compiler, which meant disabled
warnings were still emitted when (for example) including C headers from
C++ and ObjC files.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Philip Withnall
cc0e2978a4 build: Disable -Wvariadic-macros
We explicitly require support for variadic macros; see
https://wiki.gnome.org/Projects/GLib/CompilerRequirements.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Philip Withnall
e5719fd667 gosxutils: Add newline at end of file
Fixes a `-Wnewline-eof` warning when building on macOS.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 13:52:24 +00:00
Alexander Kanavin
e161c62292 gio/tests/codegen.py: bump timeout to 100 seconds
This may be necessary on overloaded CI systems.
2021-11-18 14:07:11 +01:00
Philip Withnall
c94f24cadd Merge branch 'fm/gsettings-output-sorted' into 'main'
Sort output of gsettings command-line tool

Closes #1781

See merge request GNOME/glib!2346
2021-11-18 12:40:40 +00:00