Commit Graph

24824 Commits

Author SHA1 Message Date
Philip Withnall
81193c5aac gthreadedresolver: Don’t warn on unrecognised record types
Otherwise the code isn’t forwards-compatible, and may be DOSed by
servers returning unknown records, if `G_DEBUG=fatal-warnings` is
enabled for some reason.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
51f70fe62e tests: Add tests for invalid DNS response header parsing
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
2a7b4db243 gthreadedresolver: Expose g_resolver_record_type_to_rrtype()
So that it can be used in the tests.

It’s not part of the public, documented, supported API.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
8b73d7bbf9 gthreadedresolver: Handle error returns from dn_expand() in headers
It is possible for `dn_expand()` to fail; if so, it’ll return `-1`,
which will mess up subsequent parsing.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
263ca69da8 gthreadedresolver: Check header length when parsing response
Otherwise we could read off the end of an invalid response.

oss-fuzz#42538
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Patrick Griffis
5cdacced3f tests: Add basic test framework for GResolver DNS parsing
Split out from https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2134
by Philip Withnall so it can be used in advance of HTTPS DNS record
support landing.

Reworked to no longer use test fixtures, as it’s simple enough to build
the response header in each test.

The tests are built on Unix only, as they test the parsing code in
`g_resolver_records_from_res_query()`, which is Unix-specific. The
Windows DNS APIs provide much more structured results which don’t need
parsing.
2022-03-22 12:40:12 +00:00
Alexander Shopov
96efd662c9 Update Bulgarian translation 2022-03-21 12:43:03 +00:00
Philip Withnall
2e940e125f Merge branch 'w32-skips' into 'main'
Various win32 tests skip & fixes

See merge request GNOME/glib!2540
2022-03-21 12:19:24 +00:00
Philip Withnall
48a3e8f7f2 Merge branch 'move_g_basename_test' into 'main'
Move unit test on g_basename() function to glib/tests/fileutils.c

See merge request GNOME/glib!2558
2022-03-21 12:14:59 +00:00
Philip Withnall
47f905d2f6 Merge branch 'move_relation_tests' into 'main'
Move tests/relation-test.c to glib/tests/relation.c

See merge request GNOME/glib!2559
2022-03-21 12:12:38 +00:00
Andre Klapper
513afbb09f Fix invalid markup in Bulgarian translation 2022-03-19 20:32:49 +01:00
Alexander Shopov
596fa06aaf Update Bulgarian translation 2022-03-19 16:46:07 +00:00
Sebastian Dröge
c5e12d9577 Merge branch 'wip/pwithnall/update-other-cis' into 'main'
ci: Update Coverity, mingw and Android CI images to Fedora 34

See merge request GNOME/glib!2560
2022-03-18 11:45:34 +00:00
Philip Withnall
c53129911c Merge branch 'power-profile-monitor-docs' into 'main'
gpowerprofilemonitor: Tweak wording of documentation to make more sense

See merge request GNOME/glib!2534
2022-03-18 11:34:47 +00:00
Philip Withnall
46c6ed231e ci: Update Android NDK image to Fedora 34
Don’t take the opportunity to add support for Android API 31 or update
the version of the Android NDK we’re using to r23b, though, as I
couldn’t quickly get that to work and ran out of time.

Bumping the Fedora version will at least reduce our CI repository disk
usage through sharing the base image.

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

Helps: #2605
2022-03-18 11:27:02 +00:00
Philip Withnall
4e7b76344c ci: Update mingw image to Fedora 34
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-18 10:38:41 +00:00
Philip Withnall
a9b68f1f9b ci: Update Coverity image to Fedora 34 and latest Coverity Scan tool
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-18 10:32:08 +00:00
Sebastian Dröge
a4810e652d Merge branch 'wip/pwithnall/update-fedora-ci' into 'main'
ci: Update the Fedora CI image to Fedora 34

See merge request GNOME/glib!2543
2022-03-18 10:16:07 +00:00
Sebastian Dröge
73f918b376 Merge branch 'gdbus-method-invocation-leak' into 'main'
gdbusmethodinvocation: Fix a leak on an early return path

See merge request GNOME/glib!2557
2022-03-18 09:25:28 +00:00
Sebastian Dröge
4c8caadcfa Merge branch 'strv-contains' into 'main'
gdbusconnection: Use g_strv_contains() rather than a home-grown version

See merge request GNOME/glib!2556
2022-03-18 09:04:13 +00:00
Marc-André Lureau
e38e92e37b gio/tests/codegen: skip tests that require /dev/stdout on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:20:14 +04:00
Marc-André Lureau
0bdd37b7ff glib/tests: disable a racy check on mainloop test
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
56405a2fda glib/tests: skip a failing test with a FIXME
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
20f8007f73 glib/tests: fix random failure due to rounding
GLib:ERROR:../glib/tests/timer.c:41:test_timer_basic: assertion failed (micros == ((guint64)(elapsed * 1e6)) % 1000000): (11 == 10)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
b3d6946c27 tests/socket: skip a test if AF_UNIX is not supported on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
e014b9272a gio/tests: skip filemonitor tests on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
cfc47558fc tests: enable defaultvalue and debugcontroller on win32
The test still requires dbus-daemon.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
e9d9edde82 tests: skip appmonitor test on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:14 +04:00
Philip Withnall
a7750cd020 tests: Add unit tests for GDBusMethodInvocation
These should cover everything to do with returning a value or error from
a `GDBusMethodInvocation` object.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 19:17:41 +00:00
Philip Withnall
7143457076 gdbusmethodinvocation: Drop redundant quote from warning message
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 19:05:56 +00:00
Philip Withnall
76f5460107 gdbusmethodinvocation: Fix dead code for type checking GetAll
`property_info` is only ever set for `Get` and `Set` calls, not for
`GetAll`, as it only represents a single property. So this code was
never reachable.

Move it out so that it is reachable.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 19:05:56 +00:00
Philip Withnall
a3b8846e54 gdbusmethodinvocation: Fix a leak on an early return path
When doing an early return from `g_dbus_method_invocation_return_*()`
due to passing in the wrong type (or no return value when one was
expected), the parameters were not correctly sunk and were leaked.

Fix that. A unit test will be added in a following commit.

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

Coverity CID: #1474536
2022-03-17 19:04:42 +00:00
Emmanuel Fleury
2d6dc9ff2e Move tests/relation-test.c to glib/tests/relation.c
Related to issue #1434
2022-03-17 18:36:58 +01:00
Emmanuel Fleury
372b63bf1a Convert test/relation-test.c to glib test framework 2022-03-17 18:32:31 +01:00
Emmanuel Fleury
7f7b5ba093 Move unit test on g_basename() function to glib/tests/fileutils.c
g_basename() function is defined in glib/gfileutils.c which is tested
by glib/tests/fileutils.c test set. Until now, g_basename() test was
in glib/test/utils.c. This patch move the unit test to the proper file.
2022-03-17 18:10:09 +01:00
Philip Withnall
4ef27174af tests: Use g_strv_contains() rather than a home-grown version
The public `g_strv_contains()` API didn’t exist at the time this code
was originally written. Now, happily, it does.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 16:28:41 +00:00
Philip Withnall
e4d77f7e89 gdbusconnection: Use g_strv_contains() rather than a home-grown version
The public `g_strv_contains()` API didn’t exist at the time this code
was originally written. Now, happily, it does.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 16:24:08 +00:00
Philip Withnall
9b77b75f2d Merge branch 'w32-contenttype' into 'main'
Various contenttype-related test fixes on win32

See merge request GNOME/glib!2499
2022-03-17 15:14:14 +00:00
Philip Withnall
96279325b7 Merge branch 'cleanup-warnings-split-6' into 'main'
Cleanup warnings split 6

See merge request GNOME/glib!2495
2022-03-17 15:13:14 +00:00
Philip Withnall
411a20af2b Merge branch 'find_program_python3' into 'main'
meson: simplify lookup of python command

See merge request GNOME/glib!2541
2022-03-17 15:12:39 +00:00
Philip Withnall
1756dde873 Merge branch '2312-codegen-test-leak-fix' into 'main'
tests: Fix a leak in gdbus-test-codegen test

Closes #2312

See merge request GNOME/glib!2546
2022-03-17 15:12:08 +00:00
Philip Withnall
8697c1a53c 2.72.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 15:01:31 +00:00
Charles Monzat
bc88032651 Update French translation 2022-03-17 10:57:34 +00:00
Milo Casagrande
41c9c09bc3 Update Italian translation 2022-03-17 08:34:54 +00:00
Мирослав Николић
612ab10958 Update Serbian translation 2022-03-17 06:58:23 +00:00
Simon McVittie
2fd4382821 Merge branch '2620-timezone-offset' into 'main'
gtimezone: Fix assertion failure when called with a huge offset

Closes #2620

See merge request GNOME/glib!2554
2022-03-16 16:23:35 +00:00
Philip Withnall
7ab9359af0 gtimezone: Fix assertion failure when called with a huge offset
This looks like a regression from commit 3356934db5, but prior to that
commit there was always an assertion failure when calling
`g_time_zone_new_offset()` with an offset which is too large (such as 44
hours), ever since the function was added in commit cf24867b93.

It would be ideal if we could return a `NULL` timezone to indicate the
error, but that’s not part of the API for `g_time_zone_new_offset()`, so
we have to go with the dated and not-ideal approach of returning the UTC
timezone and letting the caller figure it out.

Another potential approach would be to reduce the `offset` modulo 24
hours. This makes the error less easily detectable than if returning
UTC, though, and still returns an invalid result: `+44:00` is not the
same timezone as `+20:00` (it’s one day further ahead).

Add a unit test.

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

Fixes: #2620
2022-03-16 12:52:13 +00:00
Philip Withnall
7f0f87355b Merge branch 'mcatanzaro/typo' into 'main'
gtlsconnection: fix typo in docs

See merge request GNOME/glib!2552
2022-03-16 12:43:21 +00:00
Michael Catanzaro
69a1867d51 gtlsconnection: fix typo in docs
Grrr, copy/paste error detected.
2022-03-16 10:38:34 +00:00
Philip Withnall
b86750cb63 Merge branch 'wip/pwithnall/more-test-fixes' into 'main'
tests: More flaky test fixes to converter-stream and test-printf

See merge request GNOME/glib!2551
2022-03-16 10:32:44 +00:00