David Zeuthen 5e6f762d61 GVariant: validate that passed string is UTF-8
As discussed with Ryan on IRC.

This check is crucial because it guarantees that
g_variant_get_string() will _always_ return valid UTF-8. Except in
cases where the programmer used unsafe API such as
g_variant_new_from_data() and setting @trusted to TRUE.

In fact, this check revealed a flaw in my polkit gdbus port

 (lt-polkitd:11632): GLib-CRITICAL **: g_variant_new_string: assertion
 `g_utf8_validate (string, len, NULL)' failed

and with this I could easily find the problem by using gdb(1) and
G_DBUS=fatal-warnings.

Without this check we'd pass the non-UTF8 string all the way to the
message bus and the bus would then disconnect us. So instead I was
seeing

  g_dbus_connection_real_closed: Remote peer vanished with error:
  Underlying GIOStream returned 0 bytes on an async read
  (g-io-error-quark, 0). Exiting.

and then SIGTERM as raised by g_dbus_connection_real_closed() and my
polkitd process would exit. This behavior is much harder to debug than
failing early (as this patch implements).

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 13:38:50 -04:00
..
2010-07-07 19:34:35 -04:00
2010-07-30 19:51:18 -04:00
2010-07-12 15:33:05 -04:00
2010-07-12 15:33:05 -04:00
2010-07-07 19:34:35 -04:00
2010-07-10 23:56:45 -04:00
2010-07-07 19:34:35 -04:00
2010-07-10 23:56:45 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-01-30 12:32:37 -05:00
2010-08-03 10:25:54 -04:00
2010-07-10 23:56:45 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2008-06-15 00:03:54 +00:00
2010-07-07 19:34:35 -04:00
2010-06-23 22:32:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2009-05-23 17:52:58 +02:00
2010-07-07 19:34:35 -04:00
2009-09-04 22:45:07 +02:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-05-08 21:30:27 -04:00
2010-06-15 16:06:18 +01:00
2010-02-10 11:35:01 -05:00
2010-07-07 19:34:35 -04:00
2010-02-04 00:12:50 +02:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-04-23 15:26:49 +01:00
2010-07-10 23:56:45 -04:00
2010-07-10 23:56:45 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2008-07-28 16:52:15 +00:00
2010-07-12 17:31:03 -04:00
2010-07-07 19:34:35 -04:00
2009-06-27 11:03:47 +03:00
2010-07-07 19:34:35 -04:00
2010-07-08 19:26:25 -04:00
2010-07-07 19:34:35 -04:00
2010-02-21 17:59:15 -05:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-10 23:56:45 -04:00
2010-07-07 19:34:35 -04:00
2010-07-08 19:23:42 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-06-23 22:32:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-12 16:56:52 -04:00
2010-03-30 20:46:46 +03:00
2010-07-12 16:56:52 -04:00
2010-07-07 19:34:35 -04:00
2010-07-12 16:56:52 -04:00
2010-07-12 16:56:52 -04:00
2010-07-13 11:59:16 -04:00
2010-07-07 19:34:35 -04:00
2010-01-28 12:40:46 -05:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2009-11-30 19:53:30 -05:00
2010-07-07 19:34:35 -04:00
2010-06-20 01:14:55 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00
2010-07-12 16:56:52 -04:00
2010-07-07 19:34:35 -04:00
2010-01-05 11:32:59 +02:00
2010-02-10 11:35:01 -05:00
2010-07-31 02:07:38 -04:00
2010-07-07 19:34:35 -04:00
2010-07-07 19:34:35 -04:00