Commit Graph

26710 Commits

Author SHA1 Message Date
Nirbheek Chauhan
6abafd64d8 meson: Fix pcre static flag usage with a subproject 2022-12-31 05:13:10 +05:30
Nirbheek Chauhan
a395a7ab3d meson: Don't use outdated 'fallback:' kwarg to dependency()
The mapping is done using the wrap file now. Also update the libffi
and pcre2 subprojects at the same time.

Reported by Benjamin Gilbert at
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3172
2022-12-31 05:13:10 +05:30
Philip Withnall
2d5d990c6a Merge branch 'add-null-check-codegen' into 'main'
codegen: Check parameter before calling its interface method

See merge request GNOME/glib!3175
2022-12-30 13:44:20 +00:00
Alynx Zhou
b16201390b codegen: Check parameter before calling its interface method 2022-12-30 13:44:20 +00:00
Nirbheek Chauhan
609d58beea meson: Don't accidentally pick up pcre2 fallback in the first test
This test assumes that pcre2 is not provided by a subproject, so force
it to be that. Explicitly allow fallback in the next check (although
it's implied already).
2022-12-30 17:01:27 +05:30
Marco Trevisan
6d9bff2874 Merge branch 'coverity-fixes2' into 'main'
garray: Add some additional length assertions

See merge request GNOME/glib!3174
2022-12-30 11:17:39 +00:00
Marco Trevisan
8a3b16af23 Merge branch 'coverity-fixes' into 'main'
gdesktopappinfo: Drop an unnecessary NULL check

See merge request GNOME/glib!3173
2022-12-30 11:15:29 +00:00
Philip Withnall
41b6de661d garray: Add some additional length assertions
This should shut Coverity up.

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

Coverity CID: #1502194
2022-12-29 16:09:20 +00:00
Philip Withnall
8463155b21 gdesktopappinfo: Drop an unnecessary NULL check
`search_token` cannot be `NULL` at this point (guaranteed by all the
current call sites of `desktop_file_dir_unindexed_search()`), so remove
an unnecessary `NULL` check.

Add an assertion to make the nullability clear.

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

Coverity CID: #1502196, #1502193
2022-12-29 15:57:53 +00:00
Philip Withnall
0c640cf671 Merge branch 'md' into 'main'
codegen: Support markdown suitable for gi-docgen

See merge request GNOME/glib!3171
2022-12-29 12:42:12 +00:00
Guido Günther
4cb945d780 codegen: Support markdown suitable for gi-docgen 2022-12-29 12:42:12 +00:00
Philip Withnall
46d3a016f3 Merge branch 'write_info_file_fail' into 'main'
GLocalFile: add error handle for trash info file writing

See merge request GNOME/glib!3170
2022-12-29 12:33:55 +00:00
wangrong
95c4312941 GLocalFile: add error handle for trash info file writing 2022-12-29 12:33:55 +00:00
Philip Withnall
955ee5c752 Merge branch 'del_errsv' into 'main'
GLocalFile: Delete redundant error saving statement

See merge request GNOME/glib!3169
2022-12-29 12:29:40 +00:00
wangrong
333e9fc0ba GLocalFile: Delete redundant error saving statement 2022-12-29 12:29:39 +00:00
Philip Withnall
f0bc060e89 Merge branch 'revert-eb12afed' into 'main'
Revert "gsimpleproxyresolver: Make explicit that a port is needed for HTTP/HTTPS"

Closes #2832

See merge request GNOME/glib!3110
2022-12-22 21:57:39 +00:00
Michael Catanzaro
d246d09e5b gproxyresolver: allow implicit ports in URIs
If the port is not specified, then a default port should be assumed.
This is how everybody expects URIs to work and it's how GProxyResolver
should work too.

We already have lots of tests to ensure this works as expected; however,
the documentation currently does not allow it. Change the documentation
to match reality.

Fixes #2832
2022-12-22 15:37:27 -06:00
Michael Catanzaro
1c3f992f11 Revert "gsimpleproxyresolver: Make explicit that a port is needed for HTTP/HTTPS"
This reverts commit eb12afed6f

Instead, let's allow use of URIs without ports specified, which
indicates that a default port should be used.
2022-12-22 15:37:27 -06:00
Philip Withnall
a0ea1d7093 Merge branch 'g-win32-app-info-enhancements' into 'main'
GWin32AppInfo: Check for local file path first

Closes #2843

See merge request GNOME/glib!3160
2022-12-22 15:02:42 +00:00
Luca Bacci
3c2b15fb15 GWin32AppInfo: Fix use-after-free 2022-12-22 15:14:29 +01:00
Luca Bacci
b0b16cf06e GWin32AppInfo: Check for local file path first
When launching a registered handler we compose the command-line
string using the registered command-line template. Applications
expect files in their command-line as local paths rather than
complete URI strings.

For example,

  "Program.exe" "%1"

Should expand to

  "Program.exe" "C:\file.dat"

Rather than

  "Program.exe" "file:///C:\file.dat"

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2843
2022-12-22 15:13:10 +01:00
Philip Withnall
b1057f3bb6
2.75.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-12-21 21:26:54 +00:00
Philip Withnall
ac459f156d Merge branch '2840-2841-variant-more-fixes' into 'main'
gvariant: Check offset table doesn’t fall outside variant bounds and speed up text parsing

Closes #2840 and #2841

See merge request GNOME/glib!3163
2022-12-21 21:25:20 +00:00
Philip Withnall
21a204147b gvariant: Propagate trust when getting a child of a serialised variant
If a variant is trusted, that means all its children are trusted, so
ensure that their checked offsets are set as such.

This allows a lot of the offset table checks to be avoided when getting
children from trusted serialised tuples, which speeds things up.

No unit test is included because this is just a performance fix. If
there are other slownesses, or regressions, in serialised `GVariant`
performance, the fuzzing setup will catch them like it did this one.

This change does reduce the time to run the oss-fuzz reproducer from 80s
to about 0.7s on my machine.

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

Fixes: #2841
oss-fuzz#54314
2022-12-21 19:50:26 +00:00
Philip Withnall
78da5faccb gvariant: Check offset table doesn’t fall outside variant bounds
When dereferencing the first entry in the offset table for a tuple,
check that it doesn’t fall outside the bounds of the variant first.

This prevents an out-of-bounds read from some non-normal tuples.

This bug was introduced in commit 73d0aa81c2.

Includes a unit test, although the test will likely only catch the
original bug if run with asan enabled.

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

Fixes: #2840
oss-fuzz#54302
2022-12-21 19:50:19 +00:00
Philip Withnall
251bab3e71 gobject: Add a missing NULL check for the return from lookup_type_node_I()
This can cause a `NULL` dereference on the next line if there is no
`TypeNode` for `iface_type`, for example if `iface_type ==
G_TYPE_INVALID`.

Unlikely, but possible since this API is public.

Spotted by Coverity.

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

Coverity CID: #1501602
2022-12-21 19:16:10 +00:00
Philip Withnall
5e378c775a Merge branch 'ptr-array-new-take' into 'main'
garray: Add more G(Ptr)Array constructors to take or copy C arrays

See merge request GNOME/glib!3128
2022-12-21 18:34:13 +00:00
Emmanuele Bassi
f64fc32310 Merge branch 'disable-assert-warning-fix' into 'main'
gmenuexporter: Fix warning of unused n_items when building with G_DISABLE_ASSERT

See merge request GNOME/glib!3159
2022-12-21 18:30:26 +00:00
Emmanuele Bassi
9174af5421 Merge branch '2852-musl-siginfo-t' into 'main'
gmain: Define fallback values for siginfo_t constants for musl

Closes #2852

See merge request GNOME/glib!3158
2022-12-21 13:13:10 +00:00
Philip Withnall
8f213524b9 Merge branch 'gobject-value-set-cleanups' into 'main'
gobject: Some GValue setting code cleanups

See merge request GNOME/glib!3156
2022-12-21 13:12:54 +00:00
Philip Withnall
1abd7507be gmenuexporter: Fix warning of unused n_items when building with G_DISABLE_ASSERT
Spotted in https://gitlab.gnome.org/GNOME/glib/-/jobs/2461358

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-12-21 12:33:58 +00:00
Philip Withnall
379a982391 gmain: Define fallback values for siginfo_t constants for musl
musl doesn’t define them itself, presumably because they’re not defined
in POSIX. glibc does define them. Thankfully, the values used in glibc
match the values used internally in other musl macros.

Define the values as a fallback. As a result of this, we can get rid of
the `g_assert_if_reached()` checks in `siginfo_t_to_wait_status()`.

This should fix catching signals from a subprocess when built against
musl.

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

Fixes: #2852
2022-12-21 12:11:46 +00:00
Philip Withnall
9e2ad88455 Merge branch 'search-app-prefix-strstr' into 'main'
gdesktopappinfo: Group search results by both categories and match types

See merge request GNOME/glib!3107
2022-12-21 11:42:35 +00:00
Marco Trevisan (Treviño)
94c45f8fa2 garray: Fix a doc typo in g_ptr_array_sort() 2022-12-21 11:40:48 +00:00
Marco Trevisan (Treviño)
b15040215a garray: Add g_array_new_take() and g_array_new_take_zero_terminated()
Make it easy to handle C arrays using GArray API stealing data from other
sources.
2022-12-21 11:40:39 +00:00
Philip Withnall
6034f35e34 Merge branch '2753-vasprintf-loop' into 'main'
glib/tests: Add test to check that we abort on low-memory

See merge request GNOME/glib!2992
2022-12-21 11:10:54 +00:00
Michael Catanzaro
e4975341bc Merge branch 'mcatanzaro/gthread-posix-errno' into 'main'
gthread-posix: need to #include <errno.h>

See merge request GNOME/glib!3157
2022-12-20 23:27:00 +00:00
Michael Catanzaro
03cb4261e0 gthread-posix: need to #include <errno.h>
a79c6af23e uses errno without the required
header.
2022-12-20 17:11:29 -06:00
Marco Trevisan (Treviño)
cbb9feb6af gobject: Use some new cleaner code to set object GValues
Use some newer APIs to make the code nicer cleaner and clearer in terms of
memory ownership.
2022-12-20 17:48:21 +01:00
Marco Trevisan (Treviño)
bc59ed8fba gobject: Avoid the ref/unref dance if assigning the same to a value
g_value_set_object could lead to perform unneeded ref/unref operations in
case we were trying to set again an object to a GValue
2022-12-20 17:48:21 +01:00
Alynx Zhou
0e612effbe tests: Update search tests for desktop-icon-info
Because we now put substring match in the next group of prefix match,
the test cases should also be updated.
2022-12-20 09:59:09 +08:00
Alynx Zhou
f81a9d226b gdesktopappinfo: Group search results by both categories and match types
Substring matches can have too much unwanted results, while prefix
matches is more accurate but cannot handle some special cases, this
commit combines them by adding a match_type member, then sort and group
result with both categories and match types.

For the same category, prefix matched results will be put in the first
group and substring matched results will be put in the second group.
2022-12-20 09:59:09 +08:00
Marco Trevisan
cbee90b8a4 Merge branch 'wip/pwithnall/freebsd-again' into 'main'
Revert "ci: Temporarily only run the FreeBSD 13 CI on a schedule"

See merge request GNOME/glib!3151
2022-12-20 00:22:52 +00:00
Marco Trevisan (Treviño)
6fcecc86ac glib/tests: Add test to check that we abort on low-memory
In case we're out of memory we should abort after having printed an error
message, this is similar to crashing but not exactly the same, so ensure
we exit for SIGABRT and not because of a SIGSEV.

We use a test wrapper to ensure that both the exit code and the stderr
match what we expected.
2022-12-20 01:16:55 +01:00
Marco Trevisan
38e01b03b6 Merge branch 'tests-isolated-tmpdir' into 'main'
gtestutils: Use $G_TEST_TMPDIR as temporary directory when defined

See merge request GNOME/glib!2886
2022-12-19 21:32:56 +00:00
Marco Trevisan (Treviño)
ca0f04d1c6 gtestutils: Use $G_TEST_TMPDIR as temporary directory when defined
During tests in which we are isolating directories, we may still create
temporary files in the global temporary directory without cleaning them
because the value returned by g_get_tmp_dir() is cached when we isolate
the tests directory to the global TMPDIR.

To ensure that we're always isolating the temporary directories, let's
unset the cached temporary directory once we've defined $G_TEST_TMPDIR
so that the returned value of g_get_tmpdir() can be recomputed using the
test isolated temporary directory.
2022-12-19 21:37:19 +01:00
Marco Trevisan (Treviño)
9ea56848c2 garray: Just use one bit to hold the null teminated state
This is probably ignored for saving space because of padding optimizations,
but since we want this value to be either 0 or 1, this enforces this too.
2022-12-19 20:37:50 +01:00
Marco Trevisan (Treviño)
670c1f4173 garray: Add g_ptr_array_new_from_null_terminated_array()
It allows to create a GPtrArray from a null-terminated C array computing its
size and in case performing copies of the its values using the provided
GCopyFunc.
2022-12-19 20:37:50 +01:00
Marco Trevisan (Treviño)
c5aedc88fc garray: Add g_ptr_array_new_from_array() to copy a C array
It makes it easier (and more optimized) to create a GPtrArray from a C-style
array of pointers, in case using a GCopyFunc to duplicate the elements.
2022-12-19 20:37:49 +01:00
Marco Trevisan (Treviño)
d5efa78a12 garray: Add g_ptr_array_new_take_null_terminated()
Similar to g_ptr_array_new_take() but it also computes the length of a
zero-terminated array.
2022-12-19 20:05:30 +01:00