Commit Graph

25327 Commits

Author SHA1 Message Date
Philip Withnall
5eaf305d2e Merge branch 'expand_ghook_tests' into 'main'
Expand ghook unit tests for a better coverage and add more checks

See merge request GNOME/glib!2624
2022-05-10 17:55:24 +00:00
Emmanuel Fleury
3f085d1f4a Moving tests/mapping-test.c to glib/test/mapping.c
Helps issue #1434
2022-05-10 19:23:14 +02:00
Emmanuel Fleury
a67e9cdbe0 Convert tests/mapping-test.c to glib test framework 2022-05-10 19:21:53 +02:00
Simon McVittie
8f2a950362 Merge branch 'check-version-docs' into 'main'
gversion: Clarify that GLIB_CHECK_VERSION is a >= check

See merge request GNOME/glib!2619
2022-05-10 16:31:40 +00:00
Simon McVittie
816abcbb95 Merge branch 'scan-build-fixes' into 'main'
Add some more assertions to help scan-build out

See merge request GNOME/glib!2646
2022-05-10 16:30:18 +00:00
Philip Withnall
e0fe616dbc gvariant: Factor out type check
This will help static analysers, similarly to with the previous commit.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-10 16:29:22 +01:00
Philip Withnall
e36f2bb243 gproxyaddressenumerator: Factor out type check
This will help static analysers which think that the type of
`priv->proxy_address` could potentially change between freeing
`dest_hostname` and the `g_return_if_fail()` call below, leading to the
code to continue through to `g_object_new()` and use `dest_hostname`
after freeing it.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-10 16:23:46 +01:00
Philip Withnall
7767978725 gdbusdaemon: Add an assertion to help static analysis of refcounts
This should fix a scan-build warning about the final `name_unref()` here
being a use-after-free.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-10 16:17:38 +01:00
Philip Withnall
86927c39e0 gresource: Assert that resource has correct refcount when unregistering
This should fix a scan-build warning that `resource` is
used-after-freeing in the final `g_resource_unref()` call in
`g_static_resource_fini()`, as `g_resources_unregister_unlocked()` has
already unreffed it.

In reality, each resource has two strong refs on it while active, so the
second unref is correct.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-10 15:53:19 +01:00
Philip Withnall
4b4a5f83b2 Merge branch 'mainloop-test' into 'main'
Remove unnecessary test tests/mainloop-test.c duplicated in glib/tests/mainloop.c

See merge request GNOME/glib!2645
2022-05-10 14:40:17 +00:00
Philip Withnall
b18fec9f23 Merge branch 'meson-version-policy' into 'main'
docs: Add a Meson version policy and bump Meson version in CI

Closes #2596

See merge request GNOME/glib!2641
2022-05-10 11:43:41 +00:00
Pawan Chitrakar
7c4b4cda34 Update Nepali translation
(cherry picked from commit 37f6bc6114)
2022-05-10 09:38:00 +00:00
Emmanuel Fleury
b67de18f40 Remove unnecessary test tests/mainloop-test.c duplicated in glib/tests/mainloop.c
Related to issue #1434
2022-05-10 10:16:13 +02:00
Philip Withnall
c8ea8cafd1 Merge branch 'meson_fixes' into 'main'
meson: Check rres.compiled() before calling rres.returncode()

See merge request GNOME/glib!2642
2022-05-09 12:08:10 +00:00
Sebastian Dröge
91407cd7ef Merge branch 'use-ptrdiff' into 'main'
Cast to ptrdiff_t instead of subtracting by null

See merge request GNOME/glib!2631
2022-05-07 05:46:56 +00:00
TestingPlant
b4b2f75bfd Cast to guintptr instead of subtracting by null
Subtraction by a null pointer is undefined behavior, so it's been
replaced with a cast to guintptr.
2022-05-07 02:01:19 +00:00
illiliti
07fb19ee6e meson: Check rres.compiled() before calling rres.returncode()
As per meson spec, returncode() produces unspecified data if
compiled() == false. Check compiled() first to avoid relying
upon unspecified data.

In addition, muon -- an implemetation of meson written in C goes
further and forbids returning unspecified data. This is a good
decision, but also makes it harder to support applications which
wrongly use meson API. Therefore, application needs to be fixed.
2022-05-07 00:20:33 +03:00
Philip Withnall
cc79d5bc7f ci: Explicitly specify Python installation path on Windows
Meson used to try and guess at the Python path. While this worked fine
for GLib before, it probably didn’t work 100% for other projects, so
Meson have made it an explicit option.

Set that option with the Python path used on the Windows CI machines.

This fixes a Meson warning with Meson >0.60.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:55:28 +01:00
Philip Withnall
f2d24f0b13 ci: Bump CI image versions for new Meson and libpcre versions
As per the previous few commits.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:55:28 +01:00
Dan Nicholson
749b65fd37 subprojects: Update pcre
Recently wrapdb updated pcre from 8.37 (released in 2015!) to the
current 8.45 release. There have been several security fixes between
those releases and currently a buffer overflow is being flagged by
ostree's oss-fuzz project where pcre is installed via wrapdb.

This change was generated by `meson wrap update pcre`.
2022-05-06 13:55:28 +01:00
Philip Withnall
bd1781a356 build: Stop using Meson features deprecated in Meson <0.60
This clears some Meson warnings.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:55:28 +01:00
Xavier Claessens
374be41433 meson: Use meson.can_run_host_binaries()
It is not only shorter than `not meson.is_cross_build() or
meson.has_exe_wrapper()` but also handle the case of cross compiling to
a compatible arch such as building for i386 on an amd64.
2022-05-06 13:17:11 +01:00
Philip Withnall
25ab87d8e5 build: Drop checks and workarounds for older Meson versions
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:01:44 +01:00
Philip Withnall
1bdce46399 build: Bump Meson dependency to 0.60.0
As per the new policy in `docs/meson-version.md`, we can now bump the
dependency.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:01:44 +01:00
Philip Withnall
91c50c2927 docs: Mention how to install a new Meson version using pip in INSTALL.in
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:01:44 +01:00
Philip Withnall
7fd4ebacb3 docs: Add a Meson version policy
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2596
2022-05-06 13:01:44 +01:00
Emmanuel Fleury
647506966d Move tests/thread-test.c to glib/tests/thread-deprecated.c
Helps issue #1434
2022-05-06 10:50:40 +02:00
Philip Withnall
5ea0ecf8c7 Merge branch 'cond-wait-mips24' into 'main'
gthread: Fix futex timespec type on 32-bit kernels with 64-bit userspace

Closes #2634

See merge request GNOME/glib!2622
2022-05-05 16:49:04 +00:00
Sebastian Dröge
c53ba685f5 Merge branch 'oss-fuzz-test' into 'main'
fuzzing: Only set the writer function once

See merge request GNOME/glib!2638
2022-05-05 16:36:27 +00:00
Philip Withnall
70e7161bc5 fuzzing: Only set the writer function once
This should fix fuzzing builds since commit dfb3517d.

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

oss-fuzz#47108
2022-05-05 16:32:27 +01:00
Philip Withnall
6399ff04c3 Merge branch 'uri-preallocation' into 'main'
guri: Preallocate a buffer for building URIs

See merge request GNOME/glib!2637
2022-05-05 13:30:31 +00:00
Philip Withnall
fa5947d3e7 fuzzing: Add unit tests to check fuzzers
Test the fuzzers with one arbitrary input each, to ensure that they work
at a very basic level.

This should catch regressions in each of the fuzzers without having to
wait for them to be picked up by oss-fuzz.

These tests can be run using `meson test --suite fuzzing`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-05 14:06:57 +01:00
Philip Withnall
208ae36596 Merge branch 'threadpool_test' into 'main'
Move tests/threadpool-test.c to glib/test/thread-pool-slow.c

See merge request GNOME/glib!2634
2022-05-05 12:45:37 +00:00
Philip Withnall
17f608e382 guri: Preallocate a buffer for building URIs
Rather than reallocating the string buffer a few times as more
components are added, use a default buffer size which should hopefully
accommodate most average URIs.

The buffer size is a guess and can be tweaked in future.

This has the advantage of no longer passing a potentially-`NULL`
`scheme` to `g_string_new()`, which should placate the static analysers,
which think that `g_string_new()` shouldn’t accept `NULL`.

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

Coverity CID: #1474691
2022-05-05 13:38:44 +01:00
Sebastian Dröge
68228995d7 Merge branch 'coverity-issues' into 'main'
Add a couple of assertions to help with static analysis

See merge request GNOME/glib!2635
2022-05-05 12:27:17 +00:00
Philip Withnall
977756590c ghmac: Fix some signed/unsigned issues with g_checksum_type_get_length()
As with the previous commit, the return value from
`g_checksum_type_get_length()` is signed, but some of the `GHmac` code
was treating it as unsigned.

Add some assertions to make it clearer to static analysis that this is
OK because `GHmac` only ever calls it after validating its input, so
it’s guaranteed to never return a negative number.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-05 13:24:44 +01:00
Philip Withnall
a3911ef159 ghmac: Fix some signed/unsigned issues with g_checksum_update()
The length argument to `g_checksum_update()` is signed, allowing
`length < 0` to indicate a nul-terminated input string. However, most of
the `GHmac` machinery which calls `g_checksum_update()` uses unsigned
`gsize`s.

If any of those sizes exceed `G_MAXSSIZE` (which is very unlikely and
could only happen with a buggy caller), the unsigned-to-signed
conversion would wrap and cause `g_checksum_update()` to inappropriately
interpret the input as nul-terminated.

Fix that by adding a load of assertions and making the
unsigned-to-signed comparisons explicit.

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

Coverity CID: #1486807
2022-05-05 13:18:40 +01:00
Philip Withnall
c7c530c3b8 gdate: Add an assertion to help static analysis
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Coverity CID: #1486833
2022-05-05 11:23:49 +01:00
Philip Withnall
b810bdc94d gconvert: Add an assertion to help static analysis
`g_convert()` returns `NULL` iff it returns an error, but the static
analyser can’t quite work that out. Add an assertion to help.

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

Coverity CID: #1486844
2022-05-05 11:19:50 +01:00
Sebastian Dröge
8cf0c13e6d Merge branch 'update-closure-annotations' into 'main'
Fix closure annotations in callbacks' user data parameters

See merge request GNOME/glib!2633
2022-05-05 08:59:17 +00:00
Emmanuel Fleury
611a020308 Move tests/threadpool-test.c to glib/test/thread-pool-slow.c
Helps issue #1434
2022-05-05 10:51:16 +02:00
Emmanuel Fleury
cc41af57c3 Convert tests/threadpool-test.c to glib test framework 2022-05-05 10:47:05 +02:00
TestingPlant
168ba785a1 Remove redundant explicit closure annotations
Callbacks' user_data parameters are automatically marked as closures,
meaning there's no need to mark them as closures manually.
2022-05-05 02:49:19 +00:00
TestingPlant
1422e5f812 Rename all user datas in callbacks to user_data
The user data parameters in callbacks need to be named user_data to
generate correct closure attributes in the introspection data.
2022-05-05 02:42:26 +00:00
Nicola Fontana
ac2ab3d3c6 gspawn: Simplify async_with_pipes code
Be consistent with its docblock and directly call
`g_spawn_async_with_pipes_and_fds()` with the appropriate arguments.
2022-05-02 10:48:33 +02:00
Sebastian Dröge
0c6a1af9d6 Merge branch 'gdbus-threading-test-fix-maybe' into 'main'
tests: Reduce wakeup interval in gdbus-threading

See merge request GNOME/glib!2604
2022-04-29 08:05:52 +00:00
Sebastian Dröge
ef8e0035a5 Merge branch 'fix-gdbus-peer-object-manager-test' into 'main'
tests: Use G_TEST_OPTION_ISOLATE_DIRS in gdbus-peer-object-manager

See merge request GNOME/glib!2603
2022-04-29 08:04:33 +00:00
Sebastian Dröge
56531a7ae6 Merge branch 'combine-ci-jobs' into 'main'
ci: Combine style-check-diff and check-todos jobs into one

See merge request GNOME/glib!2598
2022-04-29 08:03:49 +00:00
Sebastian Dröge
4ea412c276 Merge branch 'unicode-normalise-leak' into 'main'
tests: Fix a minor leak in the unicode-normalize test

See merge request GNOME/glib!2606
2022-04-29 08:02:56 +00:00
Sebastian Dröge
42da5c454c Merge branch 'move-lcovrc' into 'main'
build: Move lcovrc file to root so it’s picked up by Meson

See merge request GNOME/glib!2630
2022-04-29 08:01:15 +00:00