From 74475bbef3b98cf57177b50bde1eef1e2518ed50 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Mon, 30 Sep 2024 11:00:25 +0900 Subject: [PATCH] [1.1.2] Add return check for system_info_get_platform_string() to prevent crash Change-Id: Ib8c507d9e59f0afaa8a6d3a387eeffa40cabed02 --- packaging/libmm-player.spec | 2 +- src/mm_player_priv.c | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 4b6dfe8..a168908 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -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 diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index 4f313a5..f465103 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -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; -- 2.7.4