From 6b2a0343957fd61706fb163ef667bba0ae0b126d Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 24 Dec 2024 10:56:05 +0100 Subject: [PATCH] MT#61630 media_player: allow only db_id > 0 Real db_id value must always be > 0 . Change-Id: I943cfc81af92d8a7039ca724ee3ad654aa7b6474 --- daemon/media_player.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/daemon/media_player.c b/daemon/media_player.c index 850ef466b..6ea104e8b 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -1278,7 +1278,7 @@ static mp_cached_code __media_player_add_blob_id(struct media_player *mp, mp->opts = opts; - if (opts.db_id >= 0) { + if (opts.db_id > 0) { mp->cache_index.type = MP_DB; mp->cache_index.db_id = opts.db_id; @@ -1339,7 +1339,8 @@ static bool media_player_play_blob(struct media_player *mp, media_player_opts_t if (!dst_pt) return false; - opts.db_id = -1; + /* make sure to reset db_id before using blob */ + opts.db_id = 0; mp_cached_code ret = __media_player_add_blob_id(mp, opts, dst_pt); if (ret == MPC_CACHED) return true; @@ -1351,7 +1352,8 @@ static bool media_player_play_blob(struct media_player *mp, media_player_opts_t // call->master_lock held in W static bool media_player_add_blob(struct media_player *mp, media_player_opts_t opts) { - opts.db_id = -1; + /* make sure to reset db_id before using blob */ + opts.db_id = 0; int ret = __media_player_add_blob_id(mp, opts, NULL); return ret == 0; }