Commit Graph

15623 Commits

Author SHA1 Message Date
Cédric Valmary
dbdb11ea4a Update Occitan translation 2016-10-12 08:15:41 +00:00
Hanno Boeck
391c20fb04 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:09 -05:00
Chun-wei Fan
e7c8cb02ef gwin32.c: Avoid a GCC warning
Add a pair of braces to make things more clear, to avoid a warning
when -Wparentheses is used.

Reported by Ignacio Casal Quinteiro.
2016-01-28 16:03:57 +08:00
Chun-wei Fan
360aee82ad gwin32.c: Fix build on MinGW
Apparently unlike mingw-w64 and Visual Studio, MinGW does not come with
winternl.h, which defines NTSTATUS, so we need to include ntdef.h instead
on MinGW for NTSTATUS.

Based on patch by Cédric Krier.

https://bugzilla.gnome.org/show_bug.cgi?id=756875
2016-01-05 15:17:41 +08:00
Chun-wei Fan
ea06279acd gwin32.c: Fix g_win32_check_windows_version() on 32-bit
The Windows API function RtlGetVersion() is actually a function that is
decorated by WINAPI (i.e. __stdcall), so we need to correct this so that
the symbol can be loaded correctly from ntdll.dll, so that we won't crash as
a result.  Should fix the crash due to stack overflow on 32-bit builds.

https://bugzilla.gnome.org/show_bug.cgi?id=756179
2015-10-27 09:34:18 +08:00
Chun-wei Fan
248ed96d5b gwin32.c: Fix build on MinGW and earlier MSVC
MinGW and pre-2008 Visual Studio does not have NTSTATUS automatically
defined from including the normal Windows headers, which broke the
build on these toolsets.  Fix this by including winternl.h, which will
define NTSTATUS on these toolsets.

This should fix bug 756875 for the glib-2-46 branch.
2015-10-24 11:22:26 +08:00
Chun-wei Fan
f0e1817d37 gwin32.c: Avoid deprecated Win32 API usage
The VerifyVersionInfo() Win32 API has been deprecated in Windows 10, and
there is no direct replacement for it, except by using a lower-level
RtlGetVersion() that we aquire from the Windows DDK or from ntdll.dll.

Switch g_win32_check_windows_version() to use RtlGetVersion(), and
compare its results with the input parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=756179
2015-10-07 20:47:56 +08:00
Dan Winship
9378483cb4 Fix a FIXME in the WinXP inet_pton() implementation
https://bugzilla.gnome.org/show_bug.cgi?id=749912
(cherry picked from commit f9af40a133)
2015-08-07 09:29:47 -04:00
Pedro Albuquerque
9e5f27800d Updated Portuguese translation 2015-07-29 04:41:18 +00:00
Christophe Fergeau
c7f393bba3 gapplication: Stop handle-local-options emission on errors
A signal accumulator can return TRUE to continue signal emission, and
FALSE to stop signal emission. handle-local-options callbacks can return
« return a non-negative option if you have handled your options and
want to exit the process ».

Currently, g_application_handle_local_options_accumulator (the
accumulator for the handle-local-options signal) returns TRUE on
non-negative return value (ie continue signal emission), and returns
FALSE on negative return values (ie when the default option processing
should continue).
This return value seems backward as on >= 0 values, subsequent
handle-local-options callbacks could overwrite the 'exit request' from
the handler, while on < 0 values, the handle-local-options processing
could end up early if several callbacks are listening for this signal.
In particular, the default handler for this signal
(g_application_real_handle_local_options) always returns -1 and will
overwrite >= 0 return values from other handlers.

This commit inverts the check so that signal emission stops early when
one of the handle-local-options callbacks indicates it wants processing
to stop and the process to exit.

https://bugzilla.gnome.org/show_bug.cgi?id=751598
2015-07-27 12:46:26 +02:00
Wouter Paesen
c19eaadeb4 Fix g_inet_address_to_string() on XP
https://bugzilla.gnome.org/show_bug.cgi?id=749911
(cherry picked from commit a4c3ab58cc)
2015-07-19 07:22:12 -04:00
Chun-wei Fan
675dbae302 gio/ginetaddress.c: Fix Windows XP inet_pton() Emulation
We need to be more careful when we try to assign values to gpointers, so
that means we have to assign the value to the properly-dereference
gpointer, so that the assigned value will be retained after the function
returns.  This code will be dropped soon, but it is done for XP
compatibility's sake for 2.44.

Should fix the issue reported in bug 730352 comment #24.
2015-06-23 13:53:55 +08:00
Bernd Homuth
714c600446 Updated German translation 2015-06-19 16:45:45 +00:00
Christophe Fergeau
6ea16c1cdd gapplication: Make sure --help output is translated
Currently, applications using g_application_add_main_option_entries()
won't get translated entries in --help output. We need to call
g_option_group_set_translation_domain() with a NULL domain to ensure that the
default application gettext domain (ie the one passed to the
textdomain() call) will be used for the main entries passed by the
application.

If we want to allow more flexibility on which gettext domain should be
used for these entries, new API will be needed.

https://bugzilla.gnome.org/show_bug.cgi?id=750322
2015-06-09 13:49:29 +02:00
Richard Hughes
f5169dd019 Revert "Add version macros for 2.46"
This reverts commit aa17d614e6.
2015-06-02 15:10:07 +01:00
Richard Hughes
aa17d614e6 Add version macros for 2.46 2015-06-02 14:58:31 +01:00
David Shea
52d0328f7a Add introspection annotations to GListStore
GListStore requires that item-type be derived from GObject, so specify
that the type of the item parameters is GObject so the functions can be
used via gobject-introspection.

Add a scope parameter for the callback used during insert_sorted.
2015-06-01 13:55:34 +02:00
Matthias Clasen
285c2534f4 2.44.1 2.44.1 2015-05-12 22:49:11 -04:00
Garrett Regier
b69ff1f5c1 gtype: Bump allowed number of children
Restricting the number of children to be less than 4095 can
be an issue when generating types. This is also an issue for
the Lua bindings as each Lua state will create a new GType each
time the Lua code is executed.

https://bugzilla.gnome.org/show_bug.cgi?id=747882
2015-05-12 22:45:52 -04:00
Ting-Wei Lan
dd57ba7bd1 tests: Use de_DE.UTF-8 instead of de_DE
de_DE.UTF-8 is supported by more operating systems, including FreeBSD,
NetBSD and OpenBSD.

https://bugzilla.gnome.org/show_bug.cgi?id=748612
2015-05-12 22:45:52 -04:00
Hans Petter Jansson
b9cd748cd9 gmarkup: Make append_escaped_text() slightly more robust.
https://bugzilla.gnome.org/show_bug.cgi?id=631597
2015-05-12 22:45:52 -04:00
Chun-wei Fan
5afaa316cf Fix the thumbnail-verification Test
The third parameter of the thumnail_verify() function had been updated to
const GLocalFileStat, so update the thumbnail-verification test likewise
so that the test works properly on all supported platforms.

https://bugzilla.gnome.org/show_bug.cgi?id=711547
2015-04-22 19:02:33 +08:00
Ryan Lortie
16c8a34aa2 app info: tweak default application algorithm
Always run the full algorithm for a given mime type before considering
fallback types.

This includes considering installed applications capable of handling a
particular mimetype, even if such an app is not explicitly marked as
default, and there is a default app for a less-specific type.

Specifically, this often helps with cases of installing apps that can
handle a particular subtype of text/plain.  We want to take those apps
in preference to a generic text editor, even if that editor is listed as
the default for text/plain and there is no default listed for the more
specific type.

Because of the more holistic approach taken by the algorithm, it is now
more complicated, but it also means that we can do more work while
holding the lock.  In turn, that lets us avoid duplicating some strings,
which is nice.

https://bugzilla.gnome.org/show_bug.cgi?id=744282
2015-04-22 10:53:27 +01:00
Sveinn í Felli
c2c67fc91c Updated Icelandic translation 2015-04-21 14:31:19 +00:00
Stas Solovey
12dd1cc9f3 Updated Russian translation 2015-03-30 21:42:33 +00:00
Ryan Lortie
1b992eb0d9 GListModel: roll back use of type redefinition
We declare the typedefs for GListModel and GListStore in giotypes.h, as
a matter of convention.  This is not actually required, since the
typedef is emitted as part of the G_DECLARE_* macros.

The giotypes.h approach is only used to avoid cyclic dependencies
between headers, which is not a problem in this case.

Type redefinition is a C11 feature, and although it was around in some
compilers before then, gcc 4.2.1 (from 2007) is apparently still in wide
use, being the default compiler for OpenBSD.

Eventually, we will probably hit a case where we actually need to
redefine a type, but since we're not there yet, let's back off a bit.
2015-03-25 09:37:27 -04:00
Petr Kovar
78c3ed18b8 Update Czech translation 2015-03-25 13:01:47 +01:00
Ryan Lortie
966ffb16f6 GLib 2.44.0 2.44.0 2015-03-23 12:28:50 -04:00
Muhammet Kara
677f3f36ab Updated Turkish translation 2015-03-22 00:16:33 +00:00
Philip Withnall
8848c09b68 gsocket: Document FD ownership with g_socket_new_from_fd()
https://bugzilla.gnome.org/show_bug.cgi?id=730188
2015-03-21 13:37:30 -04:00
Ask H. Larsen
73d72a7325 Updated Danish translation 2015-03-21 16:24:27 +01:00
Inaki Larranaga Murgoitio
51c354f842 Updated Basque language 2015-03-21 16:11:38 +01:00
Andika Triwidada
c91019e6e7 Updated Indonesian translation 2015-03-21 12:30:13 +00:00
Kjartan Maraas
09152ca055 Updated Norwegian bokmål translation. 2015-03-19 21:21:26 +01:00
Enrico Nicoletto
f7b23259db Updated Brazilian Portuguese translation 2015-03-19 19:45:58 +00:00
Chao-Hsiung Liao
4a6b97b748 Updated Chinese (Taiwan) translation 2015-03-18 01:56:56 +00:00
Fran Dieguez
4d3ed8db10 Updated Galician translations 2015-03-18 00:43:50 +01:00
Yosef Or Boczko
d51b82a075 Updated Hebrew translation 2015-03-17 12:26:03 +02:00
Ryan Lortie
76f77fe8c9 GLib 2.43.92 2.43.92 2015-03-16 14:25:53 -04:00
Stas Solovey
fdc7cd6dd3 Updated Russian translation 2015-03-16 10:01:52 +00:00
Matej Urbančič
e6de48e680 Updated Slovenian translation 2015-03-15 14:31:13 +01:00
Claude Paroz
e2d05dfe98 Updated French translation 2015-03-14 09:34:57 +01:00
A S Alam
7ed2928054 Translation pa updated for Gnome 2015-03-13 22:50:42 -05:00
Ryan Lortie
0de16c98f7 ContextSpecificGroup: some fixups
For all of the effort spent ensuring that this algorithm would be
correctly threadsafe, I messed up the order of operations within a
single thread when porting to the new approach.

Fix that up.

Also: fix some overzealous asserting in the testcases.  Since shutdown
is now lazy, we can never surely say !is_running at any particular point
in time.
2015-03-13 17:39:50 -04:00
Samir Ribic
7a3c8e900a Updated Bosnian translation 2015-03-13 20:57:49 +00:00
Sebastian Rasmussen
3a2c358508 Updated Swedish translation 2015-03-13 17:16:00 +00:00
Philip Withnall
c5c8bac693 goption: Mention type of G_OPTION_ARG_CALLBACK in documentation 2015-03-13 09:10:25 +00:00
Tim-Philipp Müller
627a145e16 threads: use FUTEX_WAIT_PRIVATE and FUTEX_WAKE_PRIVATE if possible
This avoids some expensive code paths in the kernel, see
http://lwn.net/Articles/229668/

https://bugzilla.gnome.org/show_bug.cgi?id=741442
2015-03-12 21:01:36 -04:00
Ryan Lortie
6fffce2588 docs: clean up a few glib issues
Fix a few typical problems, and also stop wrapping the inline definition
of g_steal_pointer in parens, since it is not necessary and it confuses
gtk-doc.
2015-03-12 17:24:05 -04:00
Ryan Lortie
bf19b8e6c3 gio docs: remote errant colon from docstring
This does not belong there.
2015-03-12 17:01:00 -04:00