void-packages/srcpkgs/pulseaudio/patches/fix-expression-with-side-effect-in-pa_assert.patch
Michal Vasilek 63a6946e87 pulseaudio: fix segfault when listing handlers
PulseAudio segfaulted when asserts were disabled and an application tried
to list handlers:

    pactl send-message /core list-handlers

This was bug was triggered with the pavucontrol 5.0 update.

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1278
2021-10-12 23:25:02 +02:00

79 lines
2.9 KiB
Diff

From e1899245703f1dfa3220af465046c287a5f1c2ba Mon Sep 17 00:00:00 2001
From: "Igor V. Kovalenko" <igor.v.kovalenko@gmail.com>
Date: Thu, 30 Sep 2021 08:40:35 +0300
Subject: [PATCH] Fix expression with side effect in pa_assert
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/641>
---
src/modules/bluetooth/module-bluez5-device.c | 4 ++--
src/pulsecore/card.c | 4 ++--
src/pulsecore/core.c | 4 ++--
src/pulsecore/dbus-util.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index 9774be5cc..afbb7e3fa 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -2513,10 +2513,10 @@ static int bluez5_device_message_handler(const char *object_path, const char *me
pa_bluetooth_profile_t profile;
const pa_a2dp_endpoint_conf *endpoint_conf;
const char *codec_name;
- struct userdata *u;
+ struct userdata *u = userdata;
bool is_a2dp_sink;
- pa_assert(u = (struct userdata *)userdata);
+ pa_assert(u);
pa_assert(message);
pa_assert(response);
diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index 23b347b59..4f5997d2c 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -467,10 +467,10 @@ int pa_card_suspend(pa_card *c, bool suspend, pa_suspend_cause_t cause) {
}
static int card_message_handler(const char *object_path, const char *message, const pa_json_object *parameters, char **response, void *userdata) {
- pa_card *c;
+ pa_card *c = userdata;
char *message_handler_path;
- pa_assert(c = (pa_card *) userdata);
+ pa_assert(c);
pa_assert(message);
pa_assert(response);
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index 174d0650e..132f08bbb 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -86,9 +86,9 @@ static char *message_handler_list(pa_core *c) {
}
static int core_message_handler(const char *object_path, const char *message, const pa_json_object *parameters, char **response, void *userdata) {
- pa_core *c;
+ pa_core *c = userdata;
- pa_assert(c = (pa_core *) userdata);
+ pa_assert(c);
pa_assert(message);
pa_assert(response);
pa_assert(pa_safe_streq(object_path, "/core"));
diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c
index 7d550204e..466a882d8 100644
--- a/src/pulsecore/dbus-util.c
+++ b/src/pulsecore/dbus-util.c
@@ -737,7 +737,7 @@ pa_proplist *pa_dbus_get_proplist_arg(DBusConnection *c, DBusMessage *msg, DBusM
pa_assert(msg);
pa_assert(iter);
- pa_assert(signature = dbus_message_iter_get_signature(iter));
+ pa_assert_se(signature = dbus_message_iter_get_signature(iter));
pa_assert_se(pa_streq(signature, "a{say}"));
dbus_free(signature);
--
GitLab