From: minje.ahn Date: Mon, 15 Aug 2022 23:31:26 +0000 (+0900) Subject: Fix heap-use-after-free bug X-Git-Tag: submit/tizen/20220816.000452^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8fb3472db04ab352104ab1448f18272bcd650ea0;p=platform%2Fcore%2Fapi%2Fmetadata-editor.git Fix heap-use-after-free bug Auto-delete is set for lists in taglib. Therefore, there is no need to free the elements to be excluded. Change-Id: Ibfe04068e7396dcdba9da01512627473ab52bac0 Signed-off-by: minje.ahn --- diff --git a/packaging/capi-media-metadata-editor.spec b/packaging/capi-media-metadata-editor.spec index 7443aae..4f59ed2 100755 --- a/packaging/capi-media-metadata-editor.spec +++ b/packaging/capi-media-metadata-editor.spec @@ -1,6 +1,6 @@ Name: capi-media-metadata-editor Summary: A metadata editor library in Tizen Native API -Version: 0.2.7 +Version: 0.2.8 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index c950c3d..17d7c17 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -177,7 +177,8 @@ static int __remove_ogg_picture(Ogg::XiphComment *xtag, int index) ME_RETV_IF(!__is_valid_index(xtag->pictureList(), index), METADATA_EDITOR_ERROR_INVALID_PARAMETER); auto it = std::next(xtag->pictureList().begin(), index); - xtag->removePicture(*it, true); + /* No need to set it to 'true'. taglib sets auto-delete. */ + xtag->removePicture(*it, false); return METADATA_EDITOR_ERROR_NONE; } @@ -288,7 +289,8 @@ public: auto lst = __file->pictureList(); ME_RETV_IF(!__is_valid_index(lst, index), METADATA_EDITOR_ERROR_INVALID_PARAMETER); - __file->removePicture(lst[index], true); + /* No need to set it to 'true'. taglib sets auto-delete. */ + __file->removePicture(lst[index], false); return METADATA_EDITOR_ERROR_NONE; }