[1.1.2] Add return check for system_info_get_platform_string() to prevent crash 36/318436/6 accepted/tizen_9.0_unified accepted/tizen_unified accepted/tizen_unified_toolchain accepted/tizen_unified_x accepted/tizen_unified_x_asan tizen tizen_9.0 accepted/tizen/9.0/unified/20241030.235032 accepted/tizen/unified/20241004.041852 accepted/tizen/unified/toolchain/20241022.122420 accepted/tizen/unified/toolchain/20241022.122858 accepted/tizen/unified/x/20241006.081955 accepted/tizen/unified/x/asan/20241013.235858 tizen_9.0_m2_release
authorGilbok Lee <gilbok.lee@samsung.com>
Mon, 30 Sep 2024 02:00:25 +0000 (11:00 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Mon, 30 Sep 2024 06:53:24 +0000 (15:53 +0900)
Change-Id: Ib8c507d9e59f0afaa8a6d3a387eeffa40cabed02

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

index 4b6dfe8..a168908 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    1.1.1
+Version:    1.1.2
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 4f313a5..f465103 100644 (file)
@@ -6366,16 +6366,26 @@ _mmplayer_pipeline_complete(GstElement *decodebin, gpointer data)
        MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-complete");
 }
 
-static int
-__mmplayer_check_profile(void)
+static bool
+__mmplayer_is_tv_profile(void)
 {
-       char *profileName;
+       char *profileName = NULL;
        static int profile_tv = -1;
 
        if (__builtin_expect(profile_tv != -1, 1))
-               return profile_tv;
+               return (profile_tv == 1);
+
+       if (system_info_get_platform_string("http://tizen.org/feature/profile", &profileName)
+               != SYSTEM_INFO_ERROR_NONE) {
+               LOGE("fail to get profile name");
+               return false;
+       }
+
+       if (!profileName) {
+               LOGE("profileName is NULL");
+               return false;
+       }
 
-       system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
        switch (*profileName) {
        case 't':
        case 'T':
@@ -6385,9 +6395,10 @@ __mmplayer_check_profile(void)
                profile_tv = 0;
                break;
        }
+
        free(profileName);
 
-       return profile_tv;
+       return (profile_tv == 1);
 }
 
 static gboolean
@@ -6458,7 +6469,7 @@ __mmplayer_verify_gapless_play_path(mmplayer_t *player)
        gint count = 0;
        gint gapless = 0;
        guint num_of_uri = 0;
-       int profile_tv = -1;
+       bool profile_tv = false;
 
        MMPLAYER_FENTER();
 
@@ -6486,7 +6497,7 @@ __mmplayer_verify_gapless_play_path(mmplayer_t *player)
                        MM_PLAYER_GAPLESS_MODE, &gapless, NULL);
 
        /* gapless playback is not supported in case of video at TV profile. */
-       profile_tv = __mmplayer_check_profile();
+       profile_tv = __mmplayer_is_tv_profile();
        if (profile_tv && video) {
                LOGW("not support video gapless playback");
                goto ERROR;