summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-07-24 11:36:57 +0200
committerRyan Lortie <desrt@desrt.ca>2014-07-24 15:51:21 +0200
commit2268628565e4fb098252e782e58709d6b525b48a (patch)
treeb630294b3744ea0c8eb7c322f3c6bdf6eb1f7e3d
parent7009e317d84f661ec63b85edb436d3a2727be488 (diff)
gdbus: Properly fix encoding of double arrays
It turns out that this bug actually would (sometimes) impact any sort of fixed-sized array with an alignment requirement of 8 due to incorrectly counting the alignment inserted between the (aligned 4) array length and the actual data. Fix this properly and remove the exception for doubles. https://bugzilla.gnome.org/show_bug.cgi?id=732754
-rw-r--r--gio/gdbusmessage.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index dcf1758ab..5ad86940f 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -1210,11 +1210,6 @@ get_type_fixed_size (const GVariantType *type)
{
/* NB: we do not treat 'b' as fixed-size here because GVariant and
* D-Bus disagree about the size.
- *
- * In addition 'd' is encoded differently by GVariant and DBus, so
- * we force (en|de)coding rather than direct use of fixed data.
- *
- * https://bugzilla.gnome.org/show_bug.cgi?id=732754
*/
switch (*g_variant_type_peek_string (type))
{
@@ -1224,7 +1219,7 @@ get_type_fixed_size (const GVariantType *type)
return 2;
case 'i': case 'u': case 'h':
return 4;
- case 'x': case 't':
+ case 'x': case 't': case 'd':
return 8;
default:
return 0;
@@ -2425,7 +2420,8 @@ append_value_to_blob (GVariant *value,
else
use_value = g_variant_ref (value);
- ensure_output_padding (mbuf, fixed_size);
+ array_payload_begin_offset += ensure_output_padding (mbuf, fixed_size);
+
array_len = g_variant_get_size (use_value);
g_memory_buffer_write (mbuf, g_variant_get_data (use_value), array_len);
g_variant_unref (use_value);