device-manager-dbus: fix crash of getting empty supported samplerates/formats 68/246268/1 accepted/tizen/unified/20201029.124849 submit/tizen/20201028.023739
authorSeungbae Shin <seungbae.shin@samsung.com>
Tue, 27 Oct 2020 11:08:46 +0000 (20:08 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Tue, 27 Oct 2020 11:10:18 +0000 (20:10 +0900)
[Version] 13.0.34
[Issue Type] Bug

Change-Id: I8faab3479f9bf2daa87d0f818b50f1a95e96caeb

packaging/pulseaudio-modules-tizen.spec
src/device-manager-dbus.c

index 0a6f996582efdbf60e80a65a84dbd650a8885271..638827d279ceb94da0c4799d12997d7daffa4955 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          13.0.33
+Version:          13.0.34
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index b9ab0717dd629e271d85a4b38ddf56c3c9b909ae..719096574c33d5cf3d3fa1bf1510c5c56be609cd 100644 (file)
@@ -1095,6 +1095,12 @@ static void handle_get_supported_sample_formats(DBusConnection *conn, DBusMessag
         return;
     }
 
+    if (!sink->supported_sample_formats) {
+        pa_log_error("supported sample formats is not set on this sink");
+        pa_dbus_send_error(conn, msg, DBUS_ERROR_NOT_SUPPORTED, "%s", "org.tizen.multimedia.audio.InvalidOperation");
+        return;
+    }
+
     dbus_message_iter_init_append(reply, &msg_iter);
     pa_assert_se(dbus_message_iter_open_container(&msg_iter, DBUS_TYPE_ARRAY, "s", &array_iter));
     for (i = 0; sink->supported_sample_formats[i] != PA_SAMPLE_MAX; i++) {
@@ -1268,6 +1274,12 @@ static void handle_get_supported_sample_rates(DBusConnection *conn, DBusMessage
         return;
     }
 
+    if (!sink->supported_sample_rates) {
+        pa_log_error("supported sample rates is not set on this sink");
+        pa_dbus_send_error(conn, msg, DBUS_ERROR_NOT_SUPPORTED, "%s", "org.tizen.multimedia.audio.InvalidOperation");
+        return;
+    }
+
     dbus_message_iter_init_append(reply, &msg_iter);
     pa_assert_se(dbus_message_iter_open_container(&msg_iter, DBUS_TYPE_ARRAY, "u", &array_iter));
     for (i = 0; sink->supported_sample_rates[i]; i++) {