15322 Commits

Author SHA1 Message Date
Cédric Valmary
5759c55d9c Update Occitan translation 2016-10-12 08:17:15 +00:00
Hanno Boeck
58273b4198 GVariant text: fix scan of positional parameters
The scanning to find the end of a positional parameter designator in
GVariant text format (e.g. '%i') is currently broken in case the 'end'
pointer is not specified.

The scan is controlled by a somewhat complicated loop that needs to deal
properly with cases like (123, %(ii)) [where '%(ii)' is to be taken
together, but the final ')' not].

This loop missed the case where a format string passed to
g_variant_new_parsed() ended immediately after such a conversion, with a
nul character.  In this case the 'end' pointer is NULL, so the only way
we can find the end is by scanning for nul in the string.

In case of g_variant_new_parsed() [which is what this code was designed
to be used for], the bug is somewhat unlikely in practice: the only way
that a valid text-form GVariant could ever contain a positional
parameter replacement at the end of the string is if this positional
parameter were the only thing being returned.  In that case, the user
would likely have opted for a more direct approach.

Unfortunately, this code is also active in the tokenisation phase of
g_variant_parse(), before positional parameters are rejected as invalid
for that case.  Anyone who calls this function with a nul-terminated
string (and no end pointer) is vulnerable to a crash from malicious user
input.  This can be seen, at the very least with many commandline tools:

  $ dconf write /x '%i'
  Segmentation fault

We fix this problem by searching for the nul character in this case, in
addition to comparing the end pointer.

This problem is almost certainly limited to being able to cause crashes.
The loop in question only performs reads and, in the security-sensitive
case, the token will be quickly rejected after the loop is finished
(since it starts with '%' and the 'app' pointer is unset).  This is
further mitigated by the fact that there are no known cases of GVariant
text format being used as part of a protocol at a privilege barrier.
2016-02-22 09:12:15 -05:00
Pedro Albuquerque
4f57a5d140 Updated Portuguese translation 2015-11-24 07:07:32 +00:00
Necdet Yücel
0d205a3fb0 Updated Turkish translation 2015-03-22 00:10:30 +00:00
Samir Ribic
fcfa6d403e Updated Bosnian translation 2015-03-14 23:05:58 +00:00
Chun-wei Fan
83bf89c39d Windows: Use Standard Networking Functions If Possible
Currently, the Windows code use Winsock2-specific APIs to try to emulate
calls such as inet_pton(), inet_ntop() and if_nametoindex(), which may not
do the job all the time.  On Vista and later, Winsock2 does provide a
proper implementation for these functions, so we can use them if they exist
on the system, by querying for them during g_networking_init().  Otherwise,
we continue to use the original code path for these, in the case of XP and
Server 2003.

This enables many of the network-address tests to pass on Windows as a
result, when the native Winsock2 implementations can be used.

https://bugzilla.gnome.org/show_bug.cgi?id=730352
2015-03-06 23:42:13 +08:00
Chun-wei Fan
4421d92763 gresolver.c: Windows: Fix IPv6 Address Handling
Check the IPv6 addresses on Windows, as we need to reject those that have
brackets/ports around them as valid addresses in this form would have been
accepted during the call to g_inet_address_new_from_string ().

https://bugzilla.gnome.org/show_bug.cgi?id=730352
2015-03-05 12:45:45 +08:00
Chun-wei Fan
7ca3886049 MSVC Builds: Few More Enahncements
Update the .pdb file generation for the MSVC 2010+ DLLs (and the x64 gspawn
helper programs), so that they match the names of the DLLs/EXEs that are
built.  Also update the .lib generation so that all will use -$(ApiVersion)
from the property sheets instead of the -2.0 which was previously hard
coded (as we will eventually move into GLib 3.x in the future, for example)
2015-03-04 20:12:20 +08:00
Chun-wei Fan
e98e02b796 Visual Studio Builds: "Install" .pdb files
They are helpful in debugging in a stack.
2015-03-03 19:22:15 +08:00
Chun-wei Fan
e39e80d42d MSVC Builds: GIO: Standardize zlib Linking
Link to zlib1.lib for all builds, as:
-The notion of zlib1d.lib is rather not standardized across the board for
 most cases.
-Easier for the grand all-in-one solution file.
2015-03-03 18:24:08 +08:00
Chun-wei Fan
712a9ad0b7 Visual Studio 2008 Builds: Speed Up Release Builds
Use the /MP option so that each project can build multiple sources in
parallel, which can cut down release build times by quite a bit.  This will
cause a brief warning for debug builds due to their use of /Gm, and builds
would otherwise proceed as they did before.

Unfortunately Visual Studio 2008 is too old to support the /d2Zi+ flag, so
we can't make a better debug situation for it at the moment.
2015-03-03 18:10:36 +08:00
Chun-wei Fan
300812fe67 MSVC Builds: Improve Build Speed and Debugging
Use Multiprocessor compilation which can cut down build times by quite a
bit and use the /d2Zi+ flag to have better debugging info being logged to
the .pdb for release builds.

These are only applicable for Visual Studio 2010/2012 and later.
2015-03-03 13:55:08 +08:00
Chun-wei Fan
eb0d4c6869 MSVC Builds: Fix "Installation"
gobjectnotifyqueue.c was dropped accidently from a previous commit, which
was a required file to install, so fix this.
2015-03-03 12:09:35 +08:00
David King
51a61124a2 gobject.h: Use correct format specifier for __LINE__
GCC 5.0, with its new -Wformat-signedness, warns about the sign being
different between a type and the format string in printf-format
messages, leading to compiler warnings with G_OBJECT_WARN_INVALID_PSPEC.
In other uses of __LINE__ inside GLib, %d is used, and GCC seems to
expect a format specifier of %d as well:
https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

https://bugzilla.gnome.org/show_bug.cgi?id=744263
2015-02-26 07:52:51 -05:00
Matthias Clasen
aea22cb4e5 2.42.2 2.42.2 2015-02-25 22:08:15 -05:00
Philip Withnall
9b19ce3338 gcancellable: Mention nullability in g_cancellable_cancel() docs
Calling g_cancellable_cancel(NULL) is an explicitly allowed no-op, for
convenience. Document and annotate that.
2015-02-25 22:03:39 -05:00
Philip Withnall
9337b31577 glist: Mention that g_list_length() is bad for checking list emptiness
Despite linked lists being a fairly fundamental computer science
concept, some developers insist on using:
    g_list_length (list) > 0
to determine whether a list is non-empty, rather than using:
    list != NULL

Add a comment to the documentation for g_list_length() and
g_slist_length() pointing out the better alternative in the hope that it
will prevent some of this abuse.

https://bugzilla.gnome.org/show_bug.cgi?id=741024
2015-02-25 22:02:35 -05:00
Ryan Lortie
b577f5174e docs: fix typo in g_settings_new_full() docstring 2015-02-25 22:02:08 -05:00
Aurélien Zanelli
d91d12d111 gnulib/vasprintf: handle unsigned modifier for long long
Otherwise, an unsigned integer will be displayed as a signed one if we
use internal printf and if HAVE_LONG_LONG_FORMAT is not defined.

https://bugzilla.gnome.org/show_bug.cgi?id=743936
2015-02-25 22:01:38 -05:00
Dan Winship
fd07c05f85 gcredentialsprivate: clarify the USE_FREEBSD_CMSGCRED users
Add comments clarifying what the three non-FreeBSD platforms using
G_CREDENTIALS_USE_FREEBSD_CMSGCRED are.
2015-02-25 22:00:49 -05:00
Peeter Must
64611c8b95 gcredentials: Add support for DragonFly
https://bugzilla.gnome.org/show_bug.cgi?id=743508
2015-02-25 22:00:38 -05:00
Ilya Konstantinov
87bf24352e gthread: add thread name support on Mac OS
https://bugzilla.gnome.org/show_bug.cgi?id=741807
2015-02-25 22:00:32 -05:00
Philip Withnall
494e865e54 gobject: Fix a typo in a documentation comment 2015-02-25 21:59:55 -05:00
Philip Withnall
1a6d1ced2f gthread: Fix a typo in a documentation comment 2015-02-25 21:59:45 -05:00
Philip Withnall
828a1b082d gstrfuncs: Document that g_ascii_dtostr() writes a nul terminator
And g_ascii_formatd().

Reviewed-by: Ryan Lortie <desrt@desrt.ca>
2015-02-25 21:59:31 -05:00
Philip Withnall
6cc096acbf gtestutils: Add links to gtester and gtester-report documentation
Link some existing text to make cross-referencing a little easier.
2015-02-25 21:59:03 -05:00
Philip Withnall
db4c85e860 gtestutils: Fix a typo in the g_test_add() documentation 2015-02-25 21:58:57 -05:00
Philip Withnall
69c7d383b4 gtestutils: Clarify that test fixtures are allocated by GLib
Make it a little clearer that the user’s fixture setup and teardown
functions don’t have to do the allocation or freeing.
2015-02-25 21:58:50 -05:00
Philip Withnall
4714352cf4 gtestutils: Fix a typo in the g_test_run() documentation 2015-02-25 21:58:28 -05:00
Philip Withnall
75403da009 gsettings: Fix a typo in the GSettings documentation
https://bugzilla.gnome.org/show_bug.cgi?id=741788
2015-02-25 21:58:08 -05:00
TingPing
9b70ddc94c Fix GContentType usage
https://bugzilla.gnome.org/show_bug.cgi?id=734946
2015-02-25 21:57:52 -05:00
Matthias Clasen
c37d690c18 Fix a typo 2015-02-25 21:57:36 -05:00
Thomas Haller
a770c0c3b6 gobject: don't use G_STRLOC in G_OBJECT_WARN_INVALID_PSPEC() macro
Using G_STRLOC ends up embedding unique strings of the form
__FILE__:__LINE__ in the compiled binary. We can avoid these
by passing __FILE__ and __LINE__ separately when constructing
the warning text.
This probably reduces the size of the binary as __FILE__ is
likely already contained as string otherwise.

Note that for GCC 2.x this changes behavior because G_STRLOC
also contained __PRETTY_FUNCTION__.

https://bugzilla.gnome.org/show_bug.cgi?id=741654
2015-02-25 21:57:15 -05:00
Philip Chimento
cdf0795e63 gfile: Explain nonobvious use of my_error
In g_file_make_directory_with_parents(), the my_error variable is used
for several different purposes throughout the whole function, not all of
which are obvious. This explains the situation with some comments.

https://bugzilla.gnome.org/show_bug.cgi?id=719455
2015-02-25 21:57:05 -05:00
Philip Chimento
a28220c00b gfile: Use g_error_matches
Make proper use of g_error_matches() instead of comparing only error codes.

https://bugzilla.gnome.org/show_bug.cgi?id=719455
2015-02-25 21:56:57 -05:00
Philip Chimento
70784ad1b7 gfile: make_directory_with_parents race condition
A race condition could cause g_file_make_directory_with_parents() to
fail with G_IO_ERROR_EXISTS despite the requested directory not
existing.

https://bugzilla.gnome.org/show_bug.cgi?id=719455
2015-02-25 21:56:47 -05:00
Ryan Lortie
18d618b1c9 ghash: minor docs tweak
We should not advise people to cast the result of
g_hash_table_get_keys_as_array() to a type that looks suitable for use
with g_strfreev().  Advise to use (const gchar **) instead.
2015-02-25 21:56:18 -05:00
Dan Winship
90be118de3 gio/tests: add a socket-listener test
Add a GSocketListener test program. Currently the only test is a
regression test for bug 712570 (based on a standalone bug reproducer
provided by Ross Lagerwall).
2015-02-25 21:54:29 -05:00
Ross Lagerwall
0c935d24f4 gio: Prevent hang when finalizing GThreadedSocketService
If all users of a GThreadedSocketService release their references to the
service while a connection thread is running, the thread function will
release the last reference to the service which causes the finalize to
deadlock waiting for all threads to finish (because it's called from the
thread function).

To fix this, don't wait for all threads to finish in the service's
finalize method.  Since the threads hold a reference to the service,
finalize should only be called when all threads are finished running (or
have unrefed the service and are about to finish).

https://bugzilla.gnome.org/show_bug.cgi?id=712570
2015-02-25 21:54:22 -05:00
Sebastian Rasmussen
8d58610b17 Updated Swedish translation 2015-02-15 19:58:12 +00:00
Paolo Borelli
b2c0f52600 Avoid warning when using G_STMT_END macro with MSVC
Workaround found on
http://cnicholson.net/2009/03/stupid-c-tricks-dowhile0-and-c4127/

https://bugzilla.gnome.org/show_bug.cgi?id=742851
2015-01-14 16:25:46 +01:00
Paolo Borelli
9c87acc1c2 Use G_STMT_START/END in gslice.h 2015-01-14 16:25:35 +01:00
Paolo Borelli
824118c207 Use G_STMT_START/END in gtestutils 2015-01-14 16:25:28 +01:00
Chun-wei Fan
7d8e194839 Win32: Update Pre-configured Config Headers
Update glibconfig.h.win32.in so that it will be in-line with the ones that
are produced with configure.ac, for use on Windows builds.

Thanks to Philip Withnall for pointing out the changes needed in bug
727829.
2015-01-07 10:07:25 +08:00
Matthias Clasen
cc23284e69 2.42.1 2.42.1 2014-11-09 18:18:12 -05:00
Krasimir Chonov
27d35c3329 Updated Bulgarian translation 2014-10-11 08:17:43 +03:00
Benjamin Gilbert
68b2b63e12 Fix g_cond_timed_wait() timeout with !CLOCK_MONOTONIC
g_get_monotonic_time() and g_get_real_time() now always use different
clocks, so we cannot avoid correcting for their offset.  Fixes failure
to time out on Mac OS X.

https://bugzilla.gnome.org/show_bug.cgi?id=738197
2014-10-10 06:43:34 -04:00
Aleksander Morgado
bf44b592c8 garray: initialize allocated size in g_byte_array_new_take()
Internal allocation size (array->alloc) was being kept to 0 when a new
GByteArray was created from an already existing heap-allocated buffer.

Among other things, this was making g_byte_array_set_size() fully clear all
the buffer contents (not just the newly allocated memory) when
G_DEBUG=gc-friendly was being used...

  if (G_UNLIKELY (g_mem_gc_friendly))
    memset (array->data + array->alloc, 0, want_alloc - array->alloc);

https://bugzilla.gnome.org/show_bug.cgi?id=738170
2014-10-10 06:43:23 -04:00
Matthias Clasen
af0a8911bc Add advice on g_cancellable_reset
Don't use it at home.
2014-10-10 06:43:13 -04:00
Milo Casagrande
d6dc0de8bf Updated Italian translation 2014-10-05 13:05:56 +00:00