From 50e52b9e84dd1bb0cbb3422a3240308f20e3f77b Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Sun, 22 Sep 2019 18:14:43 +0300
Subject: [PATCH] modules: fix reading proxy-node out GVariants

GVariant is instructed to store a 64-bit unsigned integer (mode "t")
but we pass it a pointer to a pointer to read this value out,
which will crash in 32-bit architectures, as the pointer doesn't have
enough bits and g_variant_lookup therefore corrupts the stack.
---
 modules/module-pipewire/simple-endpoint.c  | 4 ++--
 modules/module-pw-audio-softdsp-endpoint.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/module-pipewire/simple-endpoint.c b/modules/module-pipewire/simple-endpoint.c
index 953290ae..9dba4885 100644
--- a/modules/module-pipewire/simple-endpoint.c
+++ b/modules/module-pipewire/simple-endpoint.c
@@ -514,7 +514,7 @@ simple_endpoint_factory (WpFactory * factory, GType type,
   g_autoptr (WpCore) core = NULL;
   const gchar *name, *media_class;
   guint direction;
-  WpProxy *node;
+  guint64 node;
 
   /* Make sure the type is correct */
   g_return_if_fail (type == WP_TYPE_ENDPOINT);
@@ -539,6 +539,6 @@ simple_endpoint_factory (WpFactory * factory, GType type,
       "name", name,
       "media-class", media_class,
       "direction", direction,
-      "proxy-node", node,
+      "proxy-node", (gpointer) node,
       NULL);
 }
diff --git a/modules/module-pw-audio-softdsp-endpoint.c b/modules/module-pw-audio-softdsp-endpoint.c
index ca6c10b7..81a3451d 100644
--- a/modules/module-pw-audio-softdsp-endpoint.c
+++ b/modules/module-pw-audio-softdsp-endpoint.c
@@ -385,7 +385,7 @@ endpoint_factory (WpFactory * factory, GType type, GVariant * properties,
   g_autoptr (WpCore) core = NULL;
   const gchar *name, *media_class;
   guint direction;
-  WpProxy *node;
+  guint64 node;
   g_autoptr (GVariant) streams = NULL;
 
   /* Make sure the type is correct */
@@ -415,7 +415,7 @@ endpoint_factory (WpFactory * factory, GType type, GVariant * properties,
       "name", name,
       "media-class", media_class,
       "direction", direction,
-      "proxy-node", node,
+      "proxy-node", (gpointer) node,
       "streams", streams,
       NULL);
 }
-- 
GitLab