Blame SOURCES/0001-tests-Allocate-gvariant-data-from-the-heap-to-guaran.patch

407148
From 85c4031696add9797e2334ced20678edcd96c869 Mon Sep 17 00:00:00 2001
407148
From: Mart Raudsepp <leio@gentoo.org>
407148
Date: Wed, 19 Dec 2018 16:22:21 +0200
407148
Subject: [PATCH 1/2] tests: Allocate gvariant data from the heap to guarantee
407148
 alignment
407148
407148
On glib-2-58 branch we don't have !455, thus we need aligned data
407148
for the gvariant tests to not fail on i686.
407148
407148
Fixes #1626
407148
---
407148
 glib/tests/gvariant.c | 15 ++++++++++++---
407148
 1 file changed, 12 insertions(+), 3 deletions(-)
407148
407148
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
407148
index 6e417f6c1..a7b19826d 100644
407148
--- a/glib/tests/gvariant.c
407148
+++ b/glib/tests/gvariant.c
407148
@@ -4664,6 +4664,7 @@ test_stack_dict_init (void)
407148
 static void
407148
 test_normal_checking_tuples (void)
407148
 {
407148
+  gpointer aligned_data;
407148
   const guint8 data[] = {
407148
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
407148
     'a', '(', 'a', 'o', 'a', 'o', 'a', 'a', 'o', 'a', 'a', 'o', ')'
407148
@@ -4672,13 +4673,15 @@ test_normal_checking_tuples (void)
407148
   GVariant *variant = NULL;
407148
   GVariant *normal_variant = NULL;
407148
 
407148
-  variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, data, size,
407148
+  aligned_data = g_memdup (data, size); /* guarantee alignment */
407148
+  variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data, size,
407148
                                      FALSE, NULL, NULL);
407148
   g_assert_nonnull (variant);
407148
 
407148
   normal_variant = g_variant_get_normal_form (variant);
407148
   g_assert_nonnull (normal_variant);
407148
 
407148
+  g_free (aligned_data);
407148
   g_variant_unref (normal_variant);
407148
   g_variant_unref (variant);
407148
 }
407148
@@ -4790,6 +4793,7 @@ test_recursion_limits_array_in_variant (void)
407148
 static void
407148
 test_normal_checking_array_offsets (void)
407148
 {
407148
+  gpointer aligned_data;
407148
   const guint8 data[] = {
407148
     0x07, 0xe5, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
407148
     'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'g',
407148
@@ -4798,13 +4802,15 @@ test_normal_checking_array_offsets (void)
407148
   GVariant *variant = NULL;
407148
   GVariant *normal_variant = NULL;
407148
 
407148
-  variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, data, size,
407148
+  aligned_data = g_memdup (data, size); /* guarantee alignment */
407148
+  variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data, size,
407148
                                      FALSE, NULL, NULL);
407148
   g_assert_nonnull (variant);
407148
 
407148
   normal_variant = g_variant_get_normal_form (variant);
407148
   g_assert_nonnull (normal_variant);
407148
 
407148
+  g_free (aligned_data);
407148
   g_variant_unref (normal_variant);
407148
   g_variant_unref (variant);
407148
 }
407148
@@ -4838,6 +4844,7 @@ test_normal_checking_tuple_offsets (void)
407148
 static void
407148
 test_normal_checking_empty_object_path (void)
407148
 {
407148
+  gpointer aligned_data;
407148
   const guint8 data[] = {
407148
     0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
407148
     '(', 'h', '(', 'a', 'i', 'a', 'b', 'i', 'o', ')', ')',
407148
@@ -4846,13 +4853,15 @@ test_normal_checking_empty_object_path (void)
407148
   GVariant *variant = NULL;
407148
   GVariant *normal_variant = NULL;
407148
 
407148
-  variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, data, size,
407148
+  aligned_data = g_memdup (data, size); /* guarantee alignment */
407148
+  variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data, size,
407148
                                      FALSE, NULL, NULL);
407148
   g_assert_nonnull (variant);
407148
 
407148
   normal_variant = g_variant_get_normal_form (variant);
407148
   g_assert_nonnull (normal_variant);
407148
 
407148
+  g_free (aligned_data);
407148
   g_variant_unref (normal_variant);
407148
   g_variant_unref (variant);
407148
 }
407148
-- 
407148
2.19.1
407148