[0.6.54][ACR-978] add subtitle file path checking 03/132203/2 accepted/tizen/unified/20170612.073937 submit/tizen/20170608.033315 submit/tizen/20170609.042751 submit/tizen/20170612.030425
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 1 Jun 2017 12:04:37 +0000 (21:04 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Fri, 2 Jun 2017 05:01:01 +0000 (14:01 +0900)
Change-Id: I7dd505c973aa9a47b65ae39b1a530e972a669d35

packaging/libmm-player.spec
src/mm_player_priv.c

index 0e9e8070dcb04fb7ccd1da58eec72b42b7fa88fe..cc6bb2a7c62b5a21eafa1d12052534b9af92e1a3 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.53
+Version:    0.6.54
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index e08c0729966996cf2738416c5bf15ba9e84ec360..3e8fad3e6b2745a64ba152d2561a0517317b2756 100644 (file)
@@ -14293,22 +14293,40 @@ int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char* filep
 {
        int result = MM_ERROR_NONE;
        mm_player_t* player = (mm_player_t*)hplayer;
+       char *path = NULL;
 
        MMPLAYER_FENTER();
 
        /* check player handle */
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-       MMPLAYER_RETURN_VAL_IF_FAIL(filepath, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+       /* filepath can be null in idle state */
+       if (filepath) {
+               /* check file path */
+               if ((path = strstr(filepath, "file://"))) {
+                       result = util_exist_file_path(path + 7);
+               } else {
+                       result = util_exist_file_path(filepath);
+               }
+
+               if (result != MM_ERROR_NONE) {
+                       LOGE("invalid subtitle path 0x%X", result);
+                       return result; /* file not found or permission denied */
+               }
+       }
 
        if (!player->pipeline) {
-               // IDLE state
+               /* IDLE state */
                mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
                if (mmf_attrs_commit(player->attrs)) {
                        LOGE("failed to commit");       /* subtitle path will not be created */
                        return MM_ERROR_PLAYER_INTERNAL;
                }
        } else {
-               // cur state <> IDLE(READY, PAUSE, PLAYING..)
+               /* cur state <> IDLE(READY, PAUSE, PLAYING..) */
+               /* check filepath */
+               MMPLAYER_RETURN_VAL_IF_FAIL(filepath, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
                if (!__mmplayer_check_subtitle(player)) {
                        mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
                        if (mmf_attrs_commit(player->attrs)) {