19082 Commits

Author SHA1 Message Date
Daniel Mustieles
4b6fadf870 Updated Spanish translation 2018-11-28 12:18:08 +01:00
Philip Withnall
40b5853d33 Merge branch 'backport-433-date-matching-glib-2-58' into 'glib-2-58'
gdate: Use longest matching month name in g_date_set_parse (backport to glib-2-58)

See merge request GNOME/glib!471
2018-11-27 10:25:38 +00:00
Tomasz Miąsko
7fd130b32a gdate: Use longest matching month name in g_date_set_parse
There are languages where a name of one month is a substring of another.
Instead of stopping search on the first match use the month that
constitutes the longest match.

(Backport to glib-2-58: Fix minor merge conflict.)

Fixes #1343.
2018-11-27 10:07:22 +00:00
Philip Withnall
5bd159d46d Merge branch 'meson-pin-libffi-subproject' into 'glib-2-58'
meson: pin the libffi wrap file to the last release supporting meson 0.47

See merge request GNOME/glib!498
2018-11-27 10:04:31 +00:00
Christoph Reiter
04cde53ac7 meson: pin the libffi wrap file to the last release supporting meson 0.47
So we don't require a newer meson than for glib itself. See !471
2018-11-27 08:01:17 +01:00
Marek Cernocky
d32bac3701 Updated Czech translation 2018-11-24 10:11:52 +01:00
Emmanuele Bassi
6408555f32 Merge branch '425-date-init-glib-2-58' into 'glib-2-58'
gdate: Reinitialize locale information in g_date_prepare_to_parse. (backport to glib-2-58)

See merge request GNOME/glib!430
2018-11-23 16:40:29 +00:00
Emmanuele Bassi
a7a0decdb6 Merge branch '417-variant-ay-glib-2-58' into 'glib-2-58'
Fix ^*ay handling in g_variant_iter_loop() (backport to glib-2-58)

See merge request GNOME/glib!437
2018-11-23 16:39:20 +00:00
Emmanuele Bassi
c91f464fa8 Merge branch '435-short-negative-timezones-glib-2-58' into 'glib-2-58'
gdatetime: Fix formatting of time zones offsets in range -01:00 to +00:00 (backport to glib-2-58)

See merge request GNOME/glib!438
2018-11-23 16:39:00 +00:00
Emmanuele Bassi
6f5df32e72 Merge branch 'backport-456-bookmarkfile-crash-glib-2-58' into 'glib-2-58'
bookmarkfile: Don't move an item if the uri has not changed (backport to glib-2-58)

See merge request GNOME/glib!457
2018-11-23 16:38:41 +00:00
Xavier Claessens
67a7a2fabd Check for 'z' library before fallbacking to subproject 2018-11-20 10:40:39 -05:00
Xavier Claessens
0a94fcfb25 Meson: Rename test_c_args to avoid confusion with gio tests c_args 2018-11-14 10:40:24 -05:00
Xavier Claessens
c9c7509e02 Meson: Fix build error in gdbus-example-objectmanager
test_c_args is defined in the root meson.build with unfiltered list of
compiler flags, then redefined in gio/tests/meson.build after the
subdir() call. Move it before.
2018-11-14 10:40:24 -05:00
Xavier Claessens
68203b1665 Merge branch 'master' into 'master'
meson: add aarch64 memory barrier handling

See merge request GNOME/glib!462

(cherry picked from commit a72766bb9c947ad53c904bd57a69ae3f495c459e)

704522c5 meson: add aarch64 memory barrier handling
2018-11-13 18:49:01 +00:00
Michael Catanzaro
8616425bc0 Update documentation of g_tls_connection_handshake() again
I made a mistake when last updating the documentation in 94a99ae9. I
wrote that, with TLS 1.3, this would perform a rekey instead of a
rehandshake. In fact, that's only true for client connections. For
server connections, it's a no-op.

I was a bit nervous about how to document the behavior anyway, because
we really don't know what behavior will be reasonable with non-GnuTLS
crypto backends. This behavior is reasonable for the GnuTLS backend, but
might not necessarily make sense for OpenSSL. Ideally, we would
discourage API users from doing things which could have unexpected
effects, so instead of documenting what the GnuTLS backend does, I think
it'd be better to document that this is "undefined but not dangerous,"
since of course we want to make sure that existing code that doesn't
know about TLS 1.3 is not broken.


(cherry picked from commit 68878ab50b2a25f2ec9b3caf0d49a83bc489914a)
2018-11-13 01:57:24 +00:00
Aurimas Černius
e8aa448e39 Updated Lithuanian translation 2018-11-10 17:50:43 +02:00
Rafael Fontenelle
94b38e07ff Update Brazilian Portuguese translation 2018-11-08 05:59:47 +00:00
Anders Jonsson
319947dc5c Update Swedish translation 2018-11-07 18:33:19 +00:00
Florian Heiser
d273537803 Update German translation 2018-11-07 17:20:20 +00:00
Milo Casagrande
492c8f73a2 Update Italian translation 2018-11-07 08:42:40 +00:00
Emin Tufan Çetin
0abeb97826 Update Turkish translation 2018-11-06 19:47:53 +00:00
Piotr Drąg
eb181fe2c5 Update Polish translation 2018-11-06 17:23:01 +01:00
Kukuh Syafaat
976619632a Update Indonesian translation 2018-11-06 15:56:16 +00:00
Philip Withnall
5cc59cc632 Merge branch '1582-backport-411-422-ossfuzz-fixes-glib-2-58' into 'glib-2-58'
Resolve "Backport GMarkup/GVariant/GDBus fixes to glib-2-58 and glib-2-56" (glib-2-58)

See merge request GNOME/glib!447
2018-11-06 13:09:30 +00:00
Marco Trevisan (Treviño)
338614bf80 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 12:23:14 +00:00
Marco Trevisan (Treviño)
a02e111c69 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 12:23:14 +00:00
Philip Withnall
0c3db31708 tests: Rework markup parsing test to not stop on first failure
Previously, the markup parsing test would load a given markup file and
try to parse it several ways. It would return as soon as one of the
attempts failed — meaning that bugs only seen with non-nul-terminated,
or differently chunked, parse runs could never be caught.

Rework the tests so that all markup files are tested all ways, and we
assert that all ways of parsing them give the same result.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:06:51 +00:00
Philip Withnall
97674cceeb gmarkup: Fix validation of element names
Previously, the element name validation only happened if a start_element
callback was specified on the context. Element name validation should be
unconditional.

This was causing test-5.gmarkup to fail when run against the improved
tests in the following commit.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:06:51 +00:00
Philip Withnall
8cfe53f081 gmarkup: Avoid reading off the end of a buffer when non-nul-terminated
When extracting a UTF-8 character to put in an error message on parse
failure, pass the remaining buffer length to utf8_str() to avoid it
running off the end of the input buffer. It previously assumed that the
buffer was nul-terminated, which was the case in all the tests until
now.

A following commit will add test coverage for this.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:06:51 +00:00
Philip Withnall
29c1b6e72c tests: Run GMarkup tests with and without nul-termination
When using GMarkup to parse a string, the string can be provided with an
explicit length specified, or with no length and a nul terminator
instead. Run all the GMarkup tests both ways, to catch problems with
length checks, or with nul terminator checks.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:06:51 +00:00
Philip Withnall
f23ae18d79 tests: Add another GMarkup test from oss-fuzz
This doesn’t trigger any new failures, but is distinct from other tests
we have, so would be good to retain.

Related to commit cec71705406f0b2790422f0c1aa0ff3b4b464b1b.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:06:51 +00:00
Philip Withnall
f998b28cde 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:06:51 +00:00
Philip Withnall
31747d10a6 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:06:51 +00:00
Philip Withnall
c9fcac73a5 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:06:51 +00:00
Philip Withnall
0974b878cf 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:06:51 +00:00
Philip Withnall
0ad0ddfbb0 gvariant: Clarify internal documentation about GVariant type strings
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:06:51 +00:00
Philip Withnall
4624fc06ba 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:06:51 +00:00
Philip Withnall
2a42110353 gdbusmessage: Fix a typo in a documentation comment
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:06:51 +00:00
Philip Withnall
90a1df4949 gdbusmessage: Clarify error returns for g_dbus_message_new_from_blob()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 12:06:51 +00:00
Philip Withnall
2b1d4eb08c 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:06:51 +00:00
Philip Withnall
02dabf96ac 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:06:51 +00:00
Philip Withnall
d8e1290b36 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:06:51 +00:00
Philip Withnall
13af758c59 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:06:51 +00:00
Philip Withnall
d5468b90cb 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:06:51 +00:00
Philip Withnall
e78f0a79ae 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:06:51 +00:00
Philip Withnall
bfc0e49f20 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-06 12:06:51 +00:00
Philip Withnall
4d2405dc7f Merge branch '420-codegen-autoptr-glib-2-58' into 'glib-2-58'
gdbus-codegen: add autocleanup for FooObject (backport to glib-2-58)

See merge request GNOME/glib!428
2018-11-06 10:43:34 +00:00
Cédric Valmary
773408d5ba Update Occitan translation 2018-11-05 18:12:03 +00:00
Simon McVittie
abc239530b Merge branch 'backport-434-arm-atomics-glib-2-58' into 'glib-2-58'
meson: Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 on GNU/Linux if needed (backport to glib-2-58)

See merge request GNOME/glib!449
2018-11-05 12:37:39 +00:00
Simon McVittie
7d72a6763c meson: Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 on GNU/Linux if needed
armv5 Linux systems implement __sync_bool_compare_and_swap() and
friends by calling a function provided by the kernel. This is not
technically an atomic intrinsic, so gcc doesn't define
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 in this case, but it's good
enough for us. Extend the current Android special case to cover
GNU/Linux too.

The possibilities are:

* __sync_foo detected and __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 predefined:
  calls to __atomic_foo or __sync_foo primitives are inlined into user
  code by gatomic.h

* __sync_foo detected but __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not
  predefined: user code has an extern reference to g_atomic_foo(),
  which calls __atomic_foo or __sync_foo because we defined
  __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 when compiling GLib itself

* Windows: user code has an extern reference to g_atomic_foo(),
  which calls InterlockedFoo()

* !defined(G_ATOMIC_LOCK_FREE): user code has an extern reference to
  g_atomic_foo(), which emulates atomic operations with a mutex

Signed-off-by: Simon McVittie <smcv@collabora.com>
Closes: #1576
2018-11-02 20:59:36 +00:00