r54735 - in /desktop/unstable/pygobject/debian: changelog patches/closure-fix-unaligned-access.patch patches/series

jbicha at users.alioth.debian.org jbicha at users.alioth.debian.org
Sun Nov 5 02:26:54 UTC 2017


Author: jbicha
Date: Sun Nov  5 02:26:53 2017
New Revision: 54735

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=54735
Log:
Add closure-fix-unaligned-access.patch

Added:
    desktop/unstable/pygobject/debian/patches/closure-fix-unaligned-access.patch
Modified:
    desktop/unstable/pygobject/debian/changelog
    desktop/unstable/pygobject/debian/patches/series

Modified: desktop/unstable/pygobject/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/pygobject/debian/changelog?rev=54735&op=diff
==============================================================================
--- desktop/unstable/pygobject/debian/changelog	[utf-8] (original)
+++ desktop/unstable/pygobject/debian/changelog	[utf-8] Sun Nov  5 02:26:53 2017
@@ -1,6 +1,8 @@
 pygobject (3.24.1-6) UNRELEASED; urgency=medium
 
   * Build-Depend on gir1.2-gtk-3.0 for build tests
+  * Add closure-fix-unaligned-access.patch:
+    - Fix sparc64 build, thanks James Clarke! (Closes: #878317)
 
  -- Jeremy Bicha <jbicha at debian.org>  Sat, 04 Nov 2017 20:51:55 -0400
 

Added: desktop/unstable/pygobject/debian/patches/closure-fix-unaligned-access.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/pygobject/debian/patches/closure-fix-unaligned-access.patch?rev=54735&op=file
==============================================================================
--- desktop/unstable/pygobject/debian/patches/closure-fix-unaligned-access.patch	(added)
+++ desktop/unstable/pygobject/debian/patches/closure-fix-unaligned-access.patch	[utf-8] Sun Nov  5 02:26:53 2017
@@ -0,0 +1,115 @@
+From ed885bef0822b991daf37fff8710cd13e0a7f55b Mon Sep 17 00:00:00 2001
+From: James Clarke <jrtc27 at jrtc27.com>
+Date: Thu, 12 Oct 2017 19:15:29 +0100
+Subject: [PATCH] closure: Fix unaligned and out-of-bounds access
+
+When the direction is FROM_PYTHON, a whole GIArgument was being loaded
+from the address given by the argument, but like any other case, this
+could point to different types, and so could run off the end of the
+pointed-to value, and, more importantly, be performing an unaligned
+access, causing it to crash with SIGBUS on sparc64 when running
+test_callback_scope_call_array_inout. Instead, reuse the existing code
+for the TO_PYTHON case to do the copying into arg_value based on the
+type.
+---
+ gi/pygi-closure.c | 38 ++++++++++++++++++++------------------
+ 1 file changed, 20 insertions(+), 18 deletions(-)
+
+diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
+index 03bd050d..ca0135ee 100644
+--- a/gi/pygi-closure.c
++++ b/gi/pygi-closure.c
+@@ -208,6 +208,7 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
+ 
+     for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
+         PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i);
++        gpointer arg_pointer;
+ 
+         if (arg_cache->direction & PYGI_DIRECTION_FROM_PYTHON) {
+             state[i].arg_value.v_pointer = * (gpointer *) args[i];
+@@ -216,46 +217,47 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
+                 continue;
+ 
+             state[i].arg_pointer.v_pointer = state[i].arg_value.v_pointer;
+-            state[i].arg_value = *(GIArgument *) state[i].arg_value.v_pointer;
+-            continue;
++            arg_pointer = state[i].arg_value.v_pointer;
++        } else {
++            arg_pointer = args[i];
+         }
+ 
+         switch (arg_cache->type_tag) {
+             case GI_TYPE_TAG_BOOLEAN:
+-                state[i].arg_value.v_boolean = * (gboolean *) args[i];
++                state[i].arg_value.v_boolean = * (gboolean *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_INT8:
+-                state[i].arg_value.v_int8 = * (gint8 *) args[i];
++                state[i].arg_value.v_int8 = * (gint8 *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_UINT8:
+-                state[i].arg_value.v_uint8 = * (guint8 *) args[i];
++                state[i].arg_value.v_uint8 = * (guint8 *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_INT16:
+-                state[i].arg_value.v_int16 = * (gint16 *) args[i];
++                state[i].arg_value.v_int16 = * (gint16 *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_UINT16:
+-                state[i].arg_value.v_uint16 = * (guint16 *) args[i];
++                state[i].arg_value.v_uint16 = * (guint16 *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_INT32:
+-                state[i].arg_value.v_int32 = * (gint32 *) args[i];
++                state[i].arg_value.v_int32 = * (gint32 *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_UINT32:
+-                state[i].arg_value.v_uint32 = * (guint32 *) args[i];
++                state[i].arg_value.v_uint32 = * (guint32 *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_INT64:
+-                state[i].arg_value.v_int64 = * (glong *) args[i];
++                state[i].arg_value.v_int64 = * (glong *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_UINT64:
+-                state[i].arg_value.v_uint64 = * (glong *) args[i];
++                state[i].arg_value.v_uint64 = * (glong *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_FLOAT:
+-                state[i].arg_value.v_float = * (gfloat *) args[i];
++                state[i].arg_value.v_float = * (gfloat *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_DOUBLE:
+-                state[i].arg_value.v_double = * (gdouble *) args[i];
++                state[i].arg_value.v_double = * (gdouble *) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_UTF8:
+-                state[i].arg_value.v_string = * (gchar **) args[i];
++                state[i].arg_value.v_string = * (gchar **) arg_pointer;
+                 break;
+             case GI_TYPE_TAG_INTERFACE:
+             {
+@@ -266,11 +268,11 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
+                 interface_type = g_base_info_get_type (interface);
+ 
+                 if (interface_type == GI_INFO_TYPE_ENUM) {
+-                    state[i].arg_value.v_int = * (gint *) args[i];
++                    state[i].arg_value.v_int = * (gint *) arg_pointer;
+                 } else if (interface_type == GI_INFO_TYPE_FLAGS) {
+-                    state[i].arg_value.v_uint = * (guint *) args[i];
++                    state[i].arg_value.v_uint = * (guint *) arg_pointer;
+                 } else {
+-                    state[i].arg_value.v_pointer = * (gpointer *) args[i];
++                    state[i].arg_value.v_pointer = * (gpointer *) arg_pointer;
+                 }
+                 break;
+             }
+@@ -283,7 +285,7 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
+             case GI_TYPE_TAG_GSLIST:
+             case GI_TYPE_TAG_ARRAY:
+             case GI_TYPE_TAG_VOID:
+-                state[i].arg_value.v_pointer = * (gpointer *) args[i];
++                state[i].arg_value.v_pointer = * (gpointer *) arg_pointer;
+                 break;
+             default:
+                 g_warning ("Unhandled type tag %s",

Modified: desktop/unstable/pygobject/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/pygobject/debian/patches/series?rev=54735&op=diff
==============================================================================
--- desktop/unstable/pygobject/debian/patches/series	[utf-8] (original)
+++ desktop/unstable/pygobject/debian/patches/series	[utf-8] Sun Nov  5 02:26:53 2017
@@ -1 +1,2 @@
 01_cairo_region.patch
+closure-fix-unaligned-access.patch




More information about the pkg-gnome-commits mailing list