glib/glib
Ryan Lortie 998c6e65cf GVariant: fix normal-form checking for tuples
GVariant has the concept of fixed-sized types (ie: types for which all
values of the type will have the same size).  Examples are booleans,
integers, doubles, etc.  Tuples containing only these types are also
fixed size.

When GVariant is trying to deal with a fixed-sized value for which it
doesn't have a sufficient backing store (eg: the case where a
fixed-sized value was created with g_variant_new_data() with an
incorrect number of bytes) it denotes this by setting the size of the
value to the correct fixed size but using a NULL data pointer.

This is well-documented in several code comments and also in the public
API documentation for g_variant_get_data() which describes the situation
number which NULL could be returned.

The decision to deal with this case in this way was changed at the last
minute around the time that GVariant was merged -- originally we had an
elaborate setup involving allocating an internal buffer of sufficient
size to be shared between all invalid values.

Unfortunately, when making this change a small detail was missed.
gvs_tuple_get_child() (the function responsible for deserialising
tuples) was updated to properly check for this case (and it contains a
comment about why it must).  gvs_tuple_is_normal() (the function
responsible for verifying if a tuple is in normal form) was not.

We add the check now.

Note that this problem does not exist with any other container type
because tuples are the only container capable of being fixed-sized.  All
other container types (arrays, maybes, variants) can contain a variable
number of items or items of variable types (note: we consider dictionary
entries to be two-tuples).  The code for validating non-container values
also contains a check for the case of NULL data.

The problem also does not occur in the only other function dealing with
serialised tuples: gvs_tuple_n_children().  Whereas other container
types would have to inspect the serialised data to determine the number
of children, for tuples it can be determined directly from the type.
2013-01-18 16:27:13 -05:00
..
deprecated various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
glib-mirroring-tab
gnulib Fix visibility for glib/ and gio/ submodules 2013-01-18 13:23:40 -05:00
libcharset Fix visibility for glib/ and gio/ submodules 2013-01-18 13:23:40 -05:00
pcre Fix visibility for glib/ and gio/ submodules 2013-01-18 13:23:40 -05:00
tests mainloop test: fix a silly memory error 2013-01-15 15:40:14 -05:00
update-pcre regex: Import PCRE 8.31 2012-07-07 22:08:02 +02:00
.gitignore update .gitignores 2011-06-12 16:17:30 -04:00
docs.c docs: Improve G_GNUC_* documentation 2012-08-16 19:17:41 -04:00
galloca.h Move single-include guards inside include guards 2012-12-27 23:43:14 -05:00
garray.c GByteArray: Add missing transfer annotations 2012-11-09 09:32:03 +01:00
garray.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gasyncqueue.c Fix malformed GTK-Doc comment blocks: invalid parameters and tags. 2012-04-05 10:23:42 -03:00
gasyncqueue.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gasyncqueueprivate.h GAsyncQueue: Move private API to a private header 2011-10-01 20:22:46 -04:00
gatomic.c gatomic: introduce G_ATOMIC_LOCK_FREE 2011-10-18 16:45:28 -04:00
gatomic.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gbacktrace.c gbacktrace.c: special treatment for a weird symbol 2013-01-13 13:13:43 -05:00
gbacktrace.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gbase64.c comments/docs: Fix couple of typos 2012-01-28 07:52:56 +01:00
gbase64.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gbitlock.c win32: misc warning fixes 2012-11-15 14:19:06 -05:00
gbitlock.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gbookmarkfile.c glib: don't quote quark names for G_DEFINE_QUARK 2012-08-28 13:16:24 -04:00
gbookmarkfile.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gbsearcharray.h Spelling fixes 2011-08-29 14:49:32 -04:00
gbytes.c GBytes: Add missing annotations 2012-11-09 09:09:39 +01:00
gbytes.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gcharset.c Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
gcharset.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gcharsetprivate.h Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
gchecksum.c Make GChecksum more fully introspectable 2012-12-10 20:08:09 -05:00
gchecksum.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gconstructor.h Move constructor macros to an internal header and into generated code 2012-01-30 16:59:27 +01:00
gconvert.c Remove a few more G_GNUC_INTERNAL users 2013-01-18 13:28:43 -05:00
gconvert.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gdataset.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
gdataset.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gdatasetprivate.h Don't include glib.h in other headers 2010-09-03 21:24:40 -04:00
gdate.c comments/docs: Fix couple of typos 2012-01-28 07:52:56 +01:00
gdate.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gdatetime.c gdatetime: Fix some docs sed damage 2012-11-24 11:23:22 -05:00
gdatetime.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gdir.c win32: re-fix the _utf8 compat function situation 2012-11-16 08:22:06 -05:00
gdir.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gen-iswide-table.py Bug 648966 - Update g_unichar_iswide and g_unichar_iswide_cjk 2011-04-29 18:03:24 -04:00
gen-script-table.pl Bug 491554 – Update to Unicode 5.1.0 2008-04-08 02:59:05 +00:00
gen-unicode-tables.pl unicode: Add new line breaking class from unicode 6.2 2012-10-03 13:58:19 +02:00
genviron.c CVE-2012-3524: Hardening for being run in a setuid environment 2012-09-13 18:34:29 -04:00
genviron.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gerror.c Add G_GNUC_PRINTF on all functions with format strings 2013-01-13 12:32:40 -05:00
gerror.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gfileutils.c Add plural forms for some translations 2012-11-09 22:10:10 -05:00
gfileutils.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
ggettext.c Protect against strcmp() on NULL strings 2012-11-28 16:25:43 +01:00
ggettext.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
ghash.c ghash.c: fix docs 2012-10-10 10:03:15 -04:00
ghash.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
ghmac.c g_hmac_get_string: don't allocate and leak an unused buffer 2011-12-14 12:26:16 +00:00
ghmac.h Move single-include guards inside include guards 2012-12-27 23:43:14 -05:00
ghook.c documentation fixes 2011-12-13 23:01:51 -05:00
ghook.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
ghostutils.c ghostutils: Convert non-ASCII dots to '.' when converting hostnames 2010-12-15 03:56:35 -05:00
ghostutils.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gi18n-lib.h Bug 548321 – <string.h> is not included in gi18n-lib.h 2008-09-11 16:48:44 +00:00
gi18n.h Bug 548321 – <string.h> is not included in gi18n-lib.h 2008-09-11 16:48:44 +00:00
giochannel.c Fix duplicated case value for mingw runtimes defining EOVERLFOW as EFBIG 2012-11-28 16:34:18 +01:00
giochannel.h move GIOCondition to gmain.h from giochannel.h 2013-01-15 14:08:02 -05:00
giounix.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
giowin32.c win32: misc warning fixes 2012-11-15 14:19:06 -05:00
gkeyfile.c win32: misc warning fixes 2012-11-15 14:19:06 -05:00
gkeyfile.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
glib_probes.d Initial support for dtrace and systemtap 2010-05-27 14:51:41 -04:00
glib_trace.h Initial support for dtrace and systemtap 2010-05-27 14:51:41 -04:00
glib-init.c win32: misc warning fixes 2012-11-15 14:19:06 -05:00
glib-init.h Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
glib-object.h Clean up includes 2011-05-28 23:27:24 -04:00
glib-private.c various: add missing cases of #include "config.h" 2012-12-06 13:30:31 -05:00
glib-private.h Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
glib-unix.c Add a UNIX fd source 2013-01-15 14:08:02 -05:00
glib-unix.h Add a UNIX fd source 2013-01-15 14:08:02 -05:00
glib.h win32: re-fix the _utf8 compat function situation 2012-11-16 08:22:06 -05:00
glib.py glib.py: Remove old debugging code 2012-10-07 20:12:02 -03:00
glib.rc.in Update the year in the *.rc.in files 2011-06-07 08:55:31 +08:00
glib.stp.in Initial support for dtrace and systemtap 2010-05-27 14:51:41 -04:00
glibconfig.h.win32.in Update config.h.win32(.in) and glibconfig.h.win32(.in) 2012-09-26 17:47:52 +08:00
glibintl.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
glist.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
glist.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gmacros.h Add a new _GLIB_EXTERN macro for "extern" 2013-01-13 13:13:36 -05:00
gmain-internal.h Move single-include guards inside include guards 2012-12-27 23:43:14 -05:00
gmain.c Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
gmain.h gsource: Add support for file descriptors on UNIX 2013-01-15 14:08:02 -05:00
gmappedfile.c win32: misc warning fixes 2012-11-15 14:19:06 -05:00
gmappedfile.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gmarkup.c Add G_GNUC_PRINTF on all functions with format strings 2013-01-13 12:32:40 -05:00
gmarkup.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gmem.c gmem.c: array is only paritally filled by memcpy 2012-08-20 16:41:42 +02:00
gmem.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gmessages.c Revert "gtestutils: add g_test_trap_subprocess(), deprecate g_test_trap_fork()" 2012-12-19 15:20:45 -05:00
gmessages.h Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
gmirroringtable.h Bug 491554 – Update to Unicode 5.1.0 2008-04-08 02:59:05 +00:00
gnode.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
gnode.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
goption.c glib: don't quote quark names for G_DEFINE_QUARK 2012-08-28 13:16:24 -04:00
goption.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gpattern.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
gpattern.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gpoll.c Include giochannel.c for G_IO_IN, etc. 2010-09-13 16:52:51 +02:00
gpoll.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gprimes.c Move gutils docs inline 2011-06-08 23:44:39 -04:00
gprimes.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gprintf.c Replace @Varargs with @... 2011-07-22 15:47:24 +02:00
gprintf.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gprintfint.h
gqsort.c glib/gqsort.c: Fix C99ism/GCCism 2012-03-20 22:29:50 -04:00
gqsort.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gquark.c gquark: clarify G_DEFINE_QUARK docs about the use of quotes 2012-08-28 13:16:23 -04:00
gquark.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gqueue.c Fix malformed GTK-Doc comment blocks: add missing colons. 2012-04-05 10:23:39 -03:00
gqueue.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
grand.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
grand.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gregex.c glib: don't quote quark names for G_DEFINE_QUARK 2012-08-28 13:16:24 -04:00
gregex.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gscanner.c Fix malformed GTK-Doc comment blocks: add missing colons. 2012-04-05 10:23:39 -03:00
gscanner.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gscripttable.h unicode: Update to unicode 6.2.0 beta 2012-10-03 13:58:19 +02:00
gsequence.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
gsequence.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gshell.c Fix regression in g_shell_parse_argv() 2012-09-13 10:20:27 +02:00
gshell.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gslice.c comments/docs: Fix couple of typos 2012-01-28 07:52:56 +01:00
gslice.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gslist.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
gslist.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gspawn-win32-helper.c glib/giowin32.c glib/gmain.c glib/gspawn-win32.c Change gssize casts 2008-08-04 18:46:59 +00:00
gspawn-win32.c win32: misc warning fixes 2012-11-15 14:19:06 -05:00
gspawn.c Revert "gspawn: support creating pipes with O_CLOEXEC" 2012-11-15 15:33:38 +01:00
gspawn.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gstdio.c gstdio: Harden g_open() against EINTR 2012-08-27 18:10:12 -04:00
gstdio.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gstrfuncs.c Revert "Fix compilation on Android with the bionic C library" 2012-11-28 16:55:12 +01:00
gstrfuncs.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gstring.c GString: Tweak documentation, add g_string_free_to_bytes() 2012-07-06 10:19:12 -04:00
gstring.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gstringchunk.c gstringchunk.c: Include gutils.h 2011-10-04 23:08:12 +08:00
gstringchunk.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gtester-report gtester-report: Add an optional 'revision' node 2010-12-28 16:35:12 +00:00
gtester.c gtester: Add #include config.h 2013-01-15 11:05:43 -05:00
gtestutils.c Revert "gtestutils: add g_test_trap_subprocess(), deprecate g_test_trap_fork()" 2012-12-19 15:20:45 -05:00
gtestutils.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gthread-posix.c Improve g_cond_wait docs 2013-01-04 08:28:13 -05:00
gthread-win32.c Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
gthread.c Add g_get_num_processors() 2012-12-18 13:13:15 -05:00
gthread.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gthreadpool.c gthreadpool: set default max_unused_threads and max_idle_time values 2012-07-31 14:37:56 -04:00
gthreadpool.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gthreadprivate.h Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
gtimer.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
gtimer.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gtimezone.c timezone: Fix byte arithmetic 2012-12-19 13:48:31 +00:00
gtimezone.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gtrashstack.c Move GTrashStack out of gutils.[hc] 2011-10-16 16:52:24 -04:00
gtrashstack.h Move single-include guards inside include guards 2012-12-27 23:43:14 -05:00
gtree.c Use "Returns:" instead of the invalid "@returns" for annotating return values. 2012-11-01 14:47:25 +13:00
gtree.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gtypes.h Add a new _GLIB_EXTERN macro for "extern" 2013-01-13 13:13:36 -05:00
gunibreak.c Remove redundant header inclusions 2010-09-03 20:38:30 -04:00
gunibreak.h unicode: Update to unicode 6.2.0 beta 2012-10-03 13:58:19 +02:00
gunichartables.h unicode: Update to unicode 6.2.0 beta 2012-10-03 13:58:19 +02:00
gunicode.h win32: visibility fixups 2013-01-13 22:59:40 -05:00
gunicodeprivate.h Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
gunicollate.c Bug 673047 - gunicollate is broken on OS X 2012-11-16 18:51:41 +01:00
gunicomp.h unicode: Update to unicode 6.2.0 beta 2012-10-03 13:58:19 +02:00
gunidecomp.c Add missing allow-none annotations for function parameters. 2012-03-31 20:34:28 +11:00
gunidecomp.h unicode: Update to unicode 6.2.0 beta 2012-10-03 13:58:19 +02:00
guniprop.c unicode: Update to unicode 6.2.0 beta 2012-10-03 13:58:19 +02:00
gurifuncs.c g_uri_unescape_segment: Mention (allow-none)/%NULL in documentation 2012-02-29 13:09:41 -05:00
gurifuncs.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gutf8.c Fix g_utf8_validate() out argument transfer mode 2012-06-18 07:39:23 +02:00
gutils.c Remove a few more G_GNUC_INTERNAL users 2013-01-18 13:28:43 -05:00
gutils.h Add a new _GLIB_EXTERN macro for "extern" 2013-01-13 13:13:36 -05:00
gvariant-core.c various: add missing cases of #include "config.h" 2012-12-06 13:30:31 -05:00
gvariant-core.h Remove most use of G_GNUC_INTERNAL 2013-01-18 13:03:28 -05:00
gvariant-internal.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gvariant-parser.c Add G_GNUC_PRINTF on all functions with format strings 2013-01-13 12:32:40 -05:00
gvariant-serialiser.c GVariant: fix normal-form checking for tuples 2013-01-18 16:27:13 -05:00
gvariant-serialiser.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gvariant.c GVariant: add g_variant_check_format_string() 2012-08-20 16:26:25 -04:00
gvariant.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gvarianttype.c GVariantType: gut g_variant_type_check() 2012-08-27 16:12:30 -04:00
gvarianttype.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gvarianttypeinfo.c Add missing allow-none annotations for function parameters. 2012-03-31 20:34:28 +11:00
gvarianttypeinfo.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gversion.c Add flexible API version boundaries 2012-02-26 23:58:41 -05:00
gversion.h various: add GLIB_AVAILABLE_IN_ALL everywhere else 2013-01-13 13:11:57 -05:00
gversionmacros.h Add a new _GLIB_EXTERN macro for "extern" 2013-01-13 13:13:36 -05:00
gwakeup.c docs fixups for glib/ 2011-09-05 19:00:11 -04:00
gwakeup.h Remove a few more G_GNUC_INTERNAL users 2013-01-18 13:28:43 -05:00
gwin32.c Add missing allow-none annotations for function parameters. 2012-03-31 20:34:28 +11:00
gwin32.h win32: visibility fixups 2013-01-13 22:59:40 -05:00
libglib-gdb.py.in Avoid shadowing dir builtin 2010-12-03 14:41:06 -05:00
Makefile.am Remove ABI checking scripts 2013-01-17 10:50:18 -05:00
makefile.msc.in win32: Use timeGetTime as monotonic base 2011-11-16 09:10:46 +01:00
win_iconv.c win32: misc warning fixes 2012-11-15 14:19:06 -05:00