| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|\
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 73d0aa81c2575a5c9ae77d.
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
|
|\
| |
| |
| |
| | |
garray: Add more G(Ptr)Array constructors to take or copy C arrays
See merge request GNOME/glib!3128
|
| | |
|
| |
| |
| |
| |
| | |
Make it easy to handle C arrays using GArray API stealing data from other
sources.
|
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
Similar to g_ptr_array_new_take() but it also computes the length of a
zero-terminated array.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
GPtrArray is a nice interface to handle pointer arrays, however if a classic
array needs to be converted into a GPtrArray is currently needed to manually
go through all its elements and do new allocations that could be avoided.
So add g_ptr_array_new_take() which steals the data from an array of
pointers and allows to manage it using the GPtrArray API.
|
|\ \
| | |
| | |
| | |
| | | |
gmenuexporter: Fix warning of unused n_items when building with G_DISABLE_ASSERT
See merge request GNOME/glib!3159
|
| | |
| | |
| | |
| | |
| | |
| | | |
Spotted in https://gitlab.gnome.org/GNOME/glib/-/jobs/2461358
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
gmain: Define fallback values for siginfo_t constants for musl
Closes #2852
See merge request GNOME/glib!3158
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
gobject: Some GValue setting code cleanups
See merge request GNOME/glib!3156
|
| | |
| | |
| | |
| | |
| | | |
Use some newer APIs to make the code nicer cleaner and clearer in terms of
memory ownership.
|
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
gdesktopappinfo: Group search results by both categories and match types
See merge request GNOME/glib!3107
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Because we now put substring match in the next group of prefix match,
the test cases should also be updated.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
glib/tests: Add test to check that we abort on low-memory
See merge request GNOME/glib!2992
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
|\ \ \ \ \
| |_|_|/ /
|/| | | |
| | | | |
| | | | | |
gthread-posix: need to #include <errno.h>
See merge request GNOME/glib!3157
|
|/ / / /
| | | |
| | | |
| | | |
| | | | |
a79c6af23eff5ee978db62e048828c9a992a1261 uses errno without the required
header.
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
Revert "ci: Temporarily only run the FreeBSD 13 CI on a schedule"
See merge request GNOME/glib!3151
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This reverts commit 4f5bd5439e67e6e638cda22ae372a621a01057c7.
The FreeBSD CI runner is back!
See https://gitlab.gnome.org/Infrastructure/GitLab/-/issues/594#note_1620930
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
gtestutils: Use $G_TEST_TMPDIR as temporary directory when defined
See merge request GNOME/glib!2886
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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.
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
We may need to avoid using a cached temp directory for testing purposes,
so let's provide an internal API to perform such task.
This implies removing GOnce and going with mutex-based version, but
that's still using atomic logic in most unix implementations anyways.
|
|\ \ \ \ \
| |_|/ / /
|/| | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Revert "garray: Add support adding literal values"
Closes #2846
See merge request GNOME/glib!3154
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Reverts the following commits:
- ab621e15b52a57c8d95b3f4d93493c82f0f3216e.
- 85d9fb8e6c482d7b6d59efbf98040ad58d3f5008.
Too many build breaking regressions.
Fixes: #2846
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
tests: Fix stall/deadlock in slice-concurrent on macOS CI
See merge request GNOME/glib!3152
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This prevents stalls/deadlocks/timeouts on macOS. I don’t know why, as I
don’t have access to a macOS machine to test — this MR was put together
via testing on CI.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This regressed in commit 9f558a2c5017860c92d69396d36dc7a6b6a4e2af.
Not sure if it makes a functional difference to the test, though.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
glib/gthread-posix: Conditionally use `futex` and/or `futex_time64` syscalls...
See merge request GNOME/glib!3120
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
as necessary and use the correct `struct timespec` definition
On some systems only `futex_time64` exists (e.g. riscv32) while on
others only `futex` exists (old Linux, 64 bit platforms), so it is
necessary to check for both and try calling both at runtime.
Additionally use the correct `struct timespec` definition. There is not
necessarily any relation between the libc's definition and the kernel's.
Specifically, the libc headers might use 64-bit `time_t` while the kernel
headers use 32-bit `__kernel_old_time_t` on certain systems.
To get around this problem we
a) check if `futex_time64` is available, which only exists on 32-bit
platforms and always uses 64-bit `time_t`.
b) otherwise (or if that returns `ENOSYS`), we call the normal `futex`
syscall with the `struct timespec` used by the kernel, which uses
`__kernel_long_t` for both its fields. We use that instead of
`__kernel_old_time_t` because it is equivalent and available in the
kernel headers for a longer time.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
for `__NR_futex`
`cc.compiles()` is minimally faster.
We only want to check here whether `__NR_futex` is defined and don't
want to check anything at link-time.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
gspawn.c: prefer close_range() on FreeBSD if available
See merge request GNOME/glib!3144
|
| | |/ / / /
| |/| | | | |
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
gdesktopappinfo: Set XDG_ACTIVATION_TOKEN/activation-token startup ID key
Closes #2709
See merge request GNOME/glib!3090
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
See:
* https://gitlab.freedesktop.org/xdg/xdg-specs/-/blob/master/desktop-entry/desktop-entry-spec.xml#L1061-1068
* https://wayland.app/protocols/xdg-activation-v1
* https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/x11-interoperation.rst
Fixes: #2709
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
gtype: avoid "-Wcast-align" warning with optimized G_TYPE_CHECK_INSTANCE_CAST()
See merge request GNOME/glib!3139
|
| | | | | | | |
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
We can get a "-Wcast-align", if the target type that we cast to ("ct") has a
larger alignment than GTypeInstance.
That can happen on i686 architecture, if the GObject type has larger
alignment than the parent struct (or GObject). Since on i686, embeding
a "long long" or a "long double" in a struct still does not increase
the alignment beyond 4 bytes, this usually only happens when using the
__attribute__() to increase the alignment (or to have a field that has
the alignment increased).
It can happen on x86_64 when having a "long double" field.
The compiler warning is hard to avoid but not very useful, because it purely
operates on the pointer types at compile time. G_TYPE_CHECK_INSTANCE_CAST()
instead asserts (in non-optimized mode) that the pointer really points
to the expected GTypeInstance (and if that's the case, then the alignment
should be suitable already).
This is like in commit ed553e8e309d ('gtype: Eliminate -Wcast-align warnings
with G_TYPE_CHECK_INSTANCE_CAST'). But also fix the optimized code path.
With the unpatched G_TYPE_CHECK_INSTANCE_CAST() macro, the unit test would
now show the problem (with gcc-9.3.1-2.fc30.i686 or
gcc-12.2.1-4.fc37.x86_64):
$ export G_DISABLE_CAST_CHECKS=1
$ export CFLAGS='-Wcast-align=strict'
$ meson build
$ ninja -C build
...
In file included from ../gobject/gobject.h:26,
from ../gobject/gbinding.h:31,
from ../glib/glib-object.h:24,
from ../gobject/tests/objects-refcount1.c:2:
../gobject/tests/objects-refcount1.c: In function ‘my_test_dispose’:
../gobject/gtype.h:2523:42: warning: cast increases required alignment of target type [-Wcast-align]
2523 | # define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip)
| ^
../gobject/gtype.h:517:66: note: in expansion of macro ‘_G_TYPE_CIC’
517 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
| ^~~~~~~~~~~
../gobject/tests/objects-refcount1.c:9:37: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_CAST’
9 | #define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
../gobject/tests/objects-refcount1.c:96:10: note: in expansion of macro ‘MY_TEST’
96 | test = MY_TEST (object);
| ^~~~~~~
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
ghash: Use unsigned types for number of nodes and occupied ones
See merge request GNOME/glib!3148
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
It has always been considered an unsigned value, and we also returned it
straight as int in g_hash_table_size(), but it was actually used as an
int.
So use the same type of g_hash_table_size(). Not using more standard
unsigned not to risk that it may different from the guint typedef.
|
|\ \ \ \ \ \ \
| |/ / / / / /
|/| | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Fix g_array_append_val compilation on Windows
Closes #2845
See merge request GNOME/glib!3150
|
|/ / / / / / |
|