18133 Commits

Author SHA1 Message Date
Allison Lortie
34feba5a1a glib-compile-schemas: Handle per-desktop overrides
Add a new syntax to override files: if the group name has a ':' in it,
it indicates that we want to override the default values of keys for
only one desktop. For example:

[org.gnome.desktop.interface:Unity]
font-name='Ubuntu 12'

Will override the settings, only if "Unity" is found in
XDG_CURRENT_DESKTOP. Multiple per-desktop overrides can be specified
for a given key: the one which comes first in XDG_CURRENT_DESKTOP will
be used.

https://bugzilla.gnome.org/show_bug.cgi?id=746592
2021-06-23 10:03:59 -05:00
Allison Lortie
4ab36dac09 gsettingsschema: Allow per-desktop overrides
Recognise a new 'd' option in schema keys which gives a dictionary of
per-desktop default values. This dictionary is searched for the items
found in XDG_CURRENT_DESKTOP, in the order. If nothing matches (or if
the option is missing) then the default value is used as before.

This feature was requested by Alberts Muktupāvels and this patch is
based on an approach devised by them.

https://bugzilla.gnome.org/show_bug.cgi?id=746592
2021-06-23 10:03:59 -05:00
Allison Lortie
b011294015 gsettings: cleanup default value lookup
There are a couple of different ways (and soon one more) to access the
default value of a key. Clean up the various places that access this to
avoid duplication.

https://bugzilla.gnome.org/show_bug.cgi?id=746592
2021-06-23 10:03:59 -05:00
Ondrej Holy
4088f3017d gfile: Limit access to files when copying
file_copy_fallback creates new files with default permissions and
set the correct permissions after the operation is finished. This
might cause that the files can be accessible by more users during
the operation than expected. Use G_FILE_CREATE_PRIVATE for the new
files to limit access to those files.
2021-06-23 10:03:59 -05:00
Colin Walters
19e32204f5 build-sys: Pass CFLAGS to $(DTRACE)
Fedora is using https://fedoraproject.org/wiki/Changes/Annobin
to try to ensure that all objects are built with hardening flags.
Pass down `CFLAGS` to ensure the SystemTap objects use them.
2021-06-23 10:03:59 -05:00
Ray Strode
57c9f770be spawn: add shebang line to script
downstream tools get confused when the script is missing a shebang
line, and having a shebang line doesn't hurt, so add one.
2021-06-23 10:03:59 -05:00
Robert Ancell
ef9034d956 codegen: Change pointer casting to remove type-punning warnings
The existing code was generating code with undefined results that modern compilers warn about:

accounts-generated.c:204:23: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     (GDBusArgInfo **) &_accounts_accounts_method_info_list_cached_users_OUT_ARG_pointers,
2021-06-23 10:03:59 -05:00
Ray Strode
906f65da2a gdbus unix addresses test: don't g_debug when also testing stdout
At the moment the gdbus-unix-addresses test will fail if
G_MESSAGES_DEBUG is set, since the test checks stdout, and the
test has a g_debug call.

This commit drops the g_debug call, which isn't that useful anyway.
2021-06-23 10:03:59 -05:00
Марко Костић
4d478191d9 Update Serbian translation 2019-03-03 10:30:57 +00:00
Serdar Sağlam
d5799dece0 Update Turkish translation 2019-02-12 14:23:51 +00:00
Simon McVittie
d202953c47 Merge branch 'backport-552-gvariant-test-alignment-glib-2-56' into 'glib-2-56'
Backport tests: Allocate gvariant data from the heap to guarantee alignment to glib-2-56

See merge request GNOME/glib!557
2019-01-04 14:14:56 +00:00
Simon McVittie
4ef58e5661 gvariant test: Also force alignment for tuple test data
glib!552 (commit 9eed22b3) fixed this for the tests that failed on i686,
but this additional test failed on Debian's s390x port
(IBM z/Architecture, 64-bit big-endian).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-01-04 11:27:05 +00:00
Mart Raudsepp
85c4031696 tests: Allocate gvariant data from the heap to guarantee alignment
On glib-2-58 branch we don't have !455, thus we need aligned data
for the gvariant tests to not fail on i686.

Fixes #1626
2018-12-21 12:05:42 +00:00
Philip Withnall
8723aba598 2.56.4
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.56.4
2018-12-18 15:03:51 +00:00
Balázs Meskó
c90c012aa5 Update Hungarian translation 2018-12-17 09:22:42 +00:00
Matej Urbančič
d74daea9c8 Updated Slovenian translation 2018-12-02 18:02:29 +01:00
Marek Cernocky
20e5d8c566 Updated Czech translation 2018-11-24 10:10:53 +01:00
Christian Kirbach
1f09e82afc Update German translation 2018-11-15 19:48:29 +00:00
Aurimas Černius
1ca781a2cd Updated Lithuanian translation 2018-11-10 17:46:43 +02:00
Rafael Fontenelle
8f66afc198 Update Brazilian Portuguese translation 2018-11-08 05:51:40 +00:00
Anders Jonsson
c2ff887d72 Update Swedish translation 2018-11-07 18:31:22 +00:00
Philip Withnall
7f68c36f14 Merge branch 'bookmarkfile-self-move-glib-2-56' into 'glib-2-56'
bookmarkfile: Don't move an item if the uri has not changed (backport to glib-2-56)

See merge request GNOME/glib!459
2018-11-06 22:39:22 +00:00
Marco Trevisan (Treviño)
5c6f185e9b bookmarkfile: Don't move an item if the uri has not changed
This was causing a crash, because we were first removing an item, freeing
both the instance itself and the key, and then trying to reuse those.

So, in this case, instead of reassigning an item, we can just return TRUE
as we have already the item at the right place, while it's not needed to
update the modified timestamp, since no modification happened in reality.

Fixes #1588
2018-11-06 17:23:01 -05:00
Marco Trevisan (Treviño)
e46739f18c bookmarkfile: test that moving to the same name works
Verify that we can move a bookmark item to the same name, but actually this
causes a crash right now.
2018-11-06 17:22:55 -05:00
Piotr Drąg
bfd006f439 Update Polish translation 2018-11-06 17:21:16 +01:00
Kukuh Syafaat
2a9979bc38 Update Indonesian translation 2018-11-06 16:18:38 +00:00
Philip Withnall
fe4fd7319f Merge branch '1582-backport-411-422-ossfuzz-fixes-glib-2-56' into 'glib-2-56'
Resolve "Backport GMarkup/GVariant/GDBus fixes to glib-2-58 and glib-2-56" (glib-2-56)

See merge request GNOME/glib!448
2018-11-06 13:11:51 +00:00
Philip Withnall
40c8b41c67 glib: Port various callers to use g_utf8_validate_len()
These were callers which explicitly specified the string length to
g_utf8_validate(), when it couldn’t be negative, and hence should be
able to unconditionally benefit from the increased string handling
length.

At least one call site would have previously silently changed behaviour
if called with strings longer than G_MAXSSIZE in length.

Another call site was passing strlen(string) to g_utf8_validate(), which
seems pointless: just pass -1 instead, and let g_utf8_validate()
calculate the string length. Its behaviour on embedded nul bytes
wouldn’t change, as strlen() stops at the first one.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
5fab65270d gutf8: Add a g_utf8_validate_len() function
This is a variant of g_utf8_validate() which requires the length to be
specified, thereby allowing string lengths up to G_MAXSIZE rather than
just G_MAXSSIZE.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
b78fb7407a tests: Use g_assert_null() in gdbus-serialization test
This introduces no real functional changes (except when compiling with
G_DISABLE_ASSERT, in which case it fixes the test). Mostly just a code
cleanup.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
244da15037 tests: Tidy up GError handling in gdbus-serialization test
This introduces no functional changes; just a bit of code tidying.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
2eded09ba3 gvariant: Clarify internal documentation about GVariant type strings
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
8a83d15564 gdbusmessage: Check for valid GVariantType when parsing a variant blob
The code was checking whether the signature provided by the blob was a
valid D-Bus signature — but that’s a superset of a valid GVariant type
string, since a D-Bus signature is zero or more complete types. A
GVariant type string is exactly one complete type.

This meant that a D-Bus message with a header field containing a variant
with an empty type signature (for example) could cause a critical
warning in the code parsing it.

Fix that by checking whether the string is a valid type string too.

Unit test included.

oss-fuzz#9810

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
d993f42700 gdbusmessage: Fix a typo in a documentation comment
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
c387ab9c9d gdbusmessage: Clarify error returns for g_dbus_message_new_from_blob()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
20e8040a76 gdbusmessage: Improve documentation for g_dbus_message_get_header()
The caller is responsible for checking the type of the returned
GVariant.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
a770239d71 gdbusmessage: Validate type of message header signature field
Parsing a D-Bus message with the signature field in the message header
of type other than ‘g’ (GVariant type signature) would cause a critical
warning. Instead, we should return a runtime error.

Includes a test.

oss-fuzz#9825

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
355c4b4176 gvariant: Limit GVariant strings to G_MAXSSIZE
When validating a string to see if it’s valid UTF-8, we pass a gsize to
g_utf8_validate(), which only takes a gssize. For large gsize values,
this will result in the gssize actually being negative, which will
change g_utf8_validate()’s behaviour to stop at the first nul byte. That
would allow subsequent nul bytes through the string validator, against
its documented behaviour.

Add a test case.

oss-fuzz#10319

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
6cc2994dfb gvariant: Check tuple offsets against serialised data length
As with the previous commit, when getting a child from a serialised
tuple, check its offset against the length of the serialised data of the
tuple (excluding the length of the offset table). The offset was already
checked against the length of the entire serialised tuple (including the
offset table) — but a child should not be able to start inside the
offset table.

A test is included.

oss-fuzz#9803

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
fe9564feda gvariant: Check array offsets against serialised data length
When getting a child from a serialised variable array, check its offset
against the length of the serialised data of the array (excluding the
length of the offset table). The offset was already checked against the
length of the entire serialised array (including the offset table) — but a
child should not be able to start inside the offset table.

A test is included.

oss-fuzz#9803

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
a95e9f79d8 gvarianttype: Impose a recursion limit of 128 on variant types
Previously, GVariant has allowed ‘arbitrary’ recursion on GVariantTypes,
but this isn’t really feasible. We have to deal with GVariants from
untrusted sources, and the nature of GVariantType means that another
level of recursion (and hence, for example, another stack frame in your
application) can be added with a single byte in a variant type signature
in the input. This gives malicious input sources far too much leverage
to cause deep stack recursion or massive memory allocations which can
DoS an application.

Limit recursion to 128 levels (which should be more than enough for
anyone™), document it and add a test. This is, handily, also the limit
of 64 applied by the D-Bus specification (§(Valid Signatures)), plus a
bit to allow wrapping of D-Bus messages in additional layers of
variants.

oss-fuzz#9857

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:07:47 +00:00
Philip Withnall
22350edcd6 gvariant: Fix checking arithmetic for tuple element ends
When checking whether a serialised GVariant tuple is in normal form,
it’s possible for `offset_ptr -= offset_size` to underflow and wrap
around, resulting in gvs_read_unaligned_le() reading memory outside the
serialised GVariant bounds.

See §(Tuples) in gvariant-serialiser.c for the documentation on how
tuples are serialised. Briefly, all variable-length elements in the
tuple have an offset to their end stored in an array of offsets at the
end of the tuple. The width of each offset is in offset_size. offset_ptr
is added to the start of the serialised tuple to get the offset which is
currently being examined. The offset array is in reverse order compared
to the tuple elements, hence the subtraction.

The bug can be triggered if a tuple contains a load of variable-length
elements, each of whose length is actually zero (i.e. empty arrays).

Includes a unit test.

oss-fuzz#9801

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-02 16:07:09 +00:00
Philip Withnall
7ac9adbe1e ci: Update CI image to use 2-58:v1 from registry
The CI image which this glib-2-56 branch was previously using has been
deleted from the registry (master has moved on). Tweak the CI
configuration to use the glib-2-58 image, since there doesn’t seem to be
much point in adding an image just for glib-2-56, given how little
development is still needed on this branch.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-02 16:07:09 +00:00
Aurimas Černius
25f32b3352 Updated Lithuanian translation 2018-10-07 16:37:24 +03:00
Philip Withnall
c5b577fbf5 2.56.3
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.56.3
2018-09-21 10:41:56 +01:00
Matej Urbančič
e8756552e9 Updated Slovenian translation 2018-09-17 21:16:43 +02:00
Kukuh Syafaat
6f49a2f2af Update Indonesian translation 2018-09-14 13:06:07 +00:00
Balázs Úr
3fb0950701 Update Hungarian translation 2018-09-13 22:01:06 +00:00
Iain Lane
1516e47181 Merge branch 'glib-2-56-313-network-monitor-netlink-fixes' into 'glib-2-56'
Backport GNetworkMonitorNetlink fixes from !313 to glib-2-56

See merge request GNOME/glib!325
2018-09-13 14:14:50 +00:00
Iain Lane
38482ead59 gnetworkmonitornetlink: Close the socket after disconnecting its GSources
`read_netlink_messages()` is the callback attached to the netlink socket
(G_IO_IN). It calls `g_socket_receive_message()`. There is a race
condition that if the socket is closed while there is a pending call, we
will try to receive on a closed socket, which fails.

To avoid this, we switch the order of the operations around: first
destroy the source and then close the socket.
2018-09-13 14:11:30 +01:00