Fix coverity (Negative array index write) defects 44/225044/1 accepted/tizen/unified/20200218.145857 submit/tizen/20200217.053323 submit/tizen/20200217.171406
authorSeungbae Shin <seungbae.shin@samsung.com>
Mon, 17 Feb 2020 04:29:21 +0000 (13:29 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Mon, 17 Feb 2020 04:30:31 +0000 (13:30 +0900)
[Version] 0.12.61
[Issue Type] Vulnerability

Change-Id: I9ce6cd2c12fce3224a3bd4da99008a562cca076a

mm_sound_client.c
packaging/libmm-sound.spec

index 3098929..a3b4cff 100644 (file)
@@ -1117,7 +1117,7 @@ int mm_sound_client_register_focus(int pid, const char *stream_type,
        focus_init_callback(index, false);
 
 cleanup:
-       if (ret)
+       if (ret != MM_ERROR_NONE && index >= 0)
                g_focus_sound_handle[index].is_used = false;
 
        MMSOUND_LEAVE_CRITICAL_SECTION(&g_index_mutex);
@@ -1404,7 +1404,7 @@ int mm_sound_client_set_focus_watch_callback(int pid, mm_sound_focus_type_e focu
        focus_init_callback(index, true);
 
 cleanup:
-       if (ret)
+       if (ret != MM_ERROR_NONE && index >= 0)
                g_focus_sound_handle[index].is_used = false;
 
        MMSOUND_LEAVE_CRITICAL_SECTION(&g_index_mutex);
index 06487e4..805ad8d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.12.60
+Version:    0.12.61
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0