Check module's idx value to avoid dlog crash 37/284837/3 accepted/tizen/7.0/unified/20221202.171403
authorYoungHun Kim <yh8004.kim@samsung.com>
Mon, 28 Nov 2022 11:28:35 +0000 (20:28 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Mon, 28 Nov 2022 21:20:05 +0000 (06:20 +0900)
 - We have issue of dlog crash when the value of module's idx is -1.
   Unfortunately, there is no log file, so if module idx is abnormal,
   we do not take the log at first.

Change-Id: I051871c96c71aacd8d130b5b110ff72b19e2620e

packaging/mused.spec
server/include/muse_server_private.h
server/src/muse_server_connection.c
server/src/muse_server_private.c

index ab0583d..7e8e723 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mused
 Summary:    A multimedia daemon
-Version:    0.3.157
+Version:    0.3.158
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 02e4bbb..e0e6aaa 100644 (file)
@@ -131,6 +131,7 @@ gboolean ms_is_server_ready(void);
 gboolean ms_create_ready_file(void);
 void ms_remove_ready_file(void);
 const char *ms_get_command_string(int cmd);
+gboolean ms_module_idx_is_valid(muse_module_h m);
 
 #ifdef __cplusplus
 }
index 3972079..0394958 100644 (file)
@@ -61,9 +61,10 @@ static void _ms_connection_module_instance_info(muse_module_h m, ms_connection_t
 
        g_async_queue_push(ms->diag.msg_aq, (gpointer)dm);
 
-       LOGW("total number of modules = %d ( %s) - %s module %p from pid %d %s client (count %d)",
-               len, ms->instance_pid_info, ms_get_command_string(cmd), m, m->pid,
-               ms_config_get_host_name(m->idx), connection->instance_count[m->idx]);
+       if (ms_module_idx_is_valid(m))
+               LOGW("total number of modules = %d ( %s) - %s module %p from pid %d %s client (count %d)",
+                       len, ms->instance_pid_info, ms_get_command_string(cmd), m, m->pid,
+                       ms_config_get_host_name(m->idx), connection->instance_count[m->idx]);
 }
 
 int ms_connection_register(muse_module_h m)
index 74a7fba..ed508db 100644 (file)
@@ -1377,3 +1377,7 @@ const char *ms_get_command_string(int cmd)
        return "Invalid value of cmd";
 }
 
+gboolean ms_module_idx_is_valid(muse_module_h m)
+{
+       return (m->idx >= 0 && m->idx < ms_config_get_host_cnt());
+}