Commit Graph

28 Commits

Author SHA1 Message Date
Дилян Палаузов
512655aa12 minor typos in the documentation (a/an) 2019-08-24 19:14:05 +00:00
Дилян Палаузов
74583affe0 Add (out) annotation to (optional) parameters
… as the parameters are not (inout).

Closes #1837
2019-07-23 11:41:42 +00:00
Emmanuel Fleury
357c3db942 Fixing various warning in glib/gvarianttypeinfo.c
glib/gvarianttypeinfo.c:115:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'b' */ { fixed_aligned(1) },   /* boolean */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:117:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'd' */ { fixed_aligned(8) },   /* double */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:120:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'g' */ { unaligned        },   /* signature string */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:121:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'h' */ { fixed_aligned(4) },   /* file handle (int32) */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:122:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'i' */ { fixed_aligned(4) },   /* int32 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:127:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'n' */ { fixed_aligned(2) },   /* int16 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:128:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'o' */ { unaligned        },   /* object path string */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:130:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'q' */ { fixed_aligned(2) },   /* uint16 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:132:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 's' */ { unaligned        },   /* string */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:133:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 't' */ { fixed_aligned(8) },   /* uint64 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:134:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'u' */ { fixed_aligned(4) },   /* uint32 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:135:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'v' */ { aligned(8)       },   /* variant */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:137:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'x' */ { fixed_aligned(8) },   /* int64 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:138:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'y' */ { fixed_aligned(1) },   /* byte */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c: In function ‘tuple_info_free’:
glib/gvarianttypeinfo.c:368:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   for (i = 0; i < tuple_info->n_members; i++)
                 ^
glib/gvarianttypeinfo.c: In function ‘tuple_set_base_info’:
glib/gvarianttypeinfo.c:641:16: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’ [-Werror=sign-compare]
       if (m->i == -1 && m->type_info->fixed_size)
                ^~
2019-03-17 19:05:34 +01:00
Philip Withnall
faa1d63cab glib: Fix various compiler warnings when compiling with G_DISABLE_ASSERT
Mostly unused variables which are only used in a g_assert() call
otherwise.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1708
2019-03-08 19:46:21 +00:00
Philip Withnall
0c6346c98f Merge branch 'atomic-ref-count-cnd' into 'master'
Atomic reference count in GVariant, ContainerInfo and GDBus introspection

See merge request GNOME/glib!452
2018-11-08 14:22:03 +00:00
Tomasz Miąsko
b5a41afb18 gvarianttypeinfo: Use gatomicrefcount for ContainerInfo reference count 2018-11-06 14:44:25 +01:00
Philip Withnall
7b0f2e0e34 gvariant: Fix some GIR annotations on internal functions
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-06 11:50:20 +00:00
Tomasz Miąsko
03518e576e gvarianttypeinfo: Consistently use atomics to access ref_count 2018-11-01 21:55:07 +01:00
Philip Withnall
7c4e6e9fbe 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-10-23 17:01:51 +13:00
Sébastien Wilmet
f9faac7661 glib/: LGPLv2+ -> LGPLv2.1+
All glib/*.{c,h} files have been processed, as well as gtester-report.

12 of those files are not licensed under LGPL:

	gbsearcharray.h
	gconstructor.h
	glibintl.h
	gmirroringtable.h
	gscripttable.h
	gtranslit-data.h
	gunibreak.h
	gunichartables.h
	gunicomp.h
	gunidecomp.h
	valgrind.h
	win_iconv.c

Some of them are generated files, some are licensed under a BSD-style
license and win_iconv.c is in the public domain.

Sub-directories inside glib/:

	deprecated/: processed in a previous commit
	glib-mirroring-tab/: already LGPLv2.1+
	gnulib/: not modified, the code is copied from gnulib
	libcharset/: a copy
	pcre/: a copy
	tests/: processed in a previous commit

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-24 11:58:19 +02:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Robert Ancell
4143842eb4 Add missing allow-none annotations for function parameters.
Found using:
find . -name '*.c' | xargs grep 'or %NULL' | grep ' \* @' | grep -v '@error' | grep -v allow-none
2012-03-31 20:34:28 +11:00
Ryan Lortie
2a677d1370 locks: drop _INIT macros
All locks are now zero-initialised, so we can drop the G_*_INIT macros
for them.

Adjust various users around GLib accordingly and change the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=659866
2011-10-02 22:33:10 -04:00
Ryan Lortie
b6140c2f89 Port internal GStaticRecMutex users to GRecMutex 2011-09-21 16:09:04 -04:00
Ryan Lortie
37c740d509 Don't #include <glib/gslice.h> from gmem.h
It looks like this was done just to help people port from gmem to
gslice, but nothing in this header actually requires gslice.h to be
included.
2011-09-18 22:07:18 -04:00
Ryan Lortie
2c9c72dc8c GVariant: avoid 'ARRAY_INFO' as function name
Turns out that ARRAY_INFO isn't such a great name for a function since
Windows appears to declare this symbol these days.  Use a different
name.
2011-09-17 17:33:48 -04:00
Matthias Clasen
1b28408b8b Spelling fixes
Spelling fixes in comments and docs, provided by
Kjartan Maraas in bug 657336.
2011-08-29 14:49:32 -04:00
Ryan Lortie
2e53e50244 glib/: fully remove galias hacks 2010-07-07 19:34:35 -04:00
Tor Lillqvist
2ab76c5b36 Make the GVariant code compile with a non-gcc compiler
In particular, tested with Microsoft Visual C 2008.
2010-03-21 11:22:06 +02:00
Ryan Lortie
75f761bcaa GVariant variable arguments, tests, cleanups
Merge GVariant variable arguments support and put it under tests.

Also, remove the hack of the test case directly '#include'ing .c files
from glib/.  Instead, create a non-installed gvariant-internal.h that
the tests can include and make the symbols in it visible on the symbol
table of the shared library.  These symbols (as they are present in no
installed header files) are not part of the API of GLib.

Increase test coverage in a few other areas.
2010-03-08 10:31:19 -05:00
Ryan Lortie
a3c7406cce GVariantTypeInfo: fix thread safety bug
Issue caught by Michael Meeks.  This patch based on his.

GVariantTypeInfo was dropping the reference count on the TypeInfo
structure before removing it from the hash table.  This means that
another thread could come along and grab the value from the hash table
in the meantime.

Solve this by holding the lock on the table before dropping the
reference.

Also: move the hash table initialisation inside of the lock to remove
the standard double-initialisation race plus a more insidious issue
caused by the fact that we free the hash table once it becomes empty.
2010-02-25 18:13:59 -05:00
Ryan Lortie
e04c9c699c add missing #include "config.h" 2010-02-07 15:43:06 -05:00
Ryan Lortie
218c691ca3 remove #include <glib.h> from some .c files
include individual headers instead
2010-02-07 03:14:28 -05:00
Ryan Lortie
9f30337573 GVariantTypeInfo: free hash table when not in use 2010-02-07 02:52:07 -05:00
Ryan Lortie
6d6d7a8bb2 GVariantTypeInfo tweaks
1) always emit ending type FIXED for fixed sized items

    The serialiser needs to know if it dealing with a fixed sized item
    in case the serialised data is corrupt and the item has the wrong
    size.

  2) add a macro that will be used by test cases to check that all
     memory has been freed.
2010-02-04 09:08:51 -05:00
Ryan Lortie
0ac2277b49 GVariantTypeInfo changes
- rename 'type' in MemberInfo to 'type_info'
 - add 'ending_type' field to MemberInfo
 - document how to find the ending
2010-02-02 23:39:21 -05:00
Ryan Lortie
0f246e28ca merge GVariantTypeInfo 2010-01-30 20:15:25 -05:00