[0.2.47] check union_type before read msg 38/123438/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 5 Apr 2017 12:07:56 +0000 (21:07 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 5 Apr 2017 12:07:56 +0000 (21:07 +0900)
Change-Id: I55ef931413a728226a0307ccc506d4526b73f493

legacy/src/legacy_player.c
packaging/mmsvc-player.spec

index 976fe2f94ec525fe54ede92d00bbaf09e52ed9a9..5dfbc0df4fc78e52899309091033329e03d8d0d1 100644 (file)
@@ -684,10 +684,22 @@ static int __msg_callback(int message, void *param, void *user_data)
                break;
        case MM_MESSAGE_STATE_INTERRUPTED:      /* 0x04 */
                if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]) {
-                       handle->state = __convert_player_state(msg->state.current);
-                       if (handle->state == PLAYER_STATE_READY)
-                               handle->is_stopped = TRUE;
-                       ((player_interrupted_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])(__convert_interrupted_code(msg->code), handle->user_data[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]);
+                       int code = 0;
+                       if (msg->union_type == MM_MSG_UNION_STATE) {
+
+                               handle->state = __convert_player_state(msg->state.current);
+                               LOGD("update player state to %d", handle->state);
+
+                               if (handle->state == PLAYER_STATE_READY)
+                                       handle->is_stopped = TRUE;
+                               code = msg->state.code;
+                       } else if (msg->union_type == MM_MSG_UNION_CODE) {
+                               code = msg->code;
+                       } else {
+                               LOGE("invalid msg type %d", msg->union_type);
+                               break;
+                       }
+                       ((player_interrupted_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])(__convert_interrupted_code(code), handle->user_data[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]);
                }
                break;
        case MM_MESSAGE_CONNECTION_TIMEOUT:     /* 0x102 */
index 570feb26700eea12f55673faf5d9c03fc3313e90..97166da7255b1e1d1e151d61322b832c2cbbd6e9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.46
+Version:    0.2.47
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0