Fix heap-use-after-free bug 65/279665/2 accepted/tizen/unified/20220817.075309 submit/tizen/20220816.000452 submit/tizen/20220816.230510
authorminje.ahn <minje.ahn@samsung.com>
Mon, 15 Aug 2022 23:31:26 +0000 (08:31 +0900)
committerminje.ahn <minje.ahn@samsung.com>
Mon, 15 Aug 2022 23:39:44 +0000 (08:39 +0900)
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 <minje.ahn@samsung.com>
packaging/capi-media-metadata-editor.spec
src/metadata_editor.cpp

index 7443aaea68569a1d122ff058474806359e103926..4f59ed29dad24f454416ba37db48fb21ac5909bf 100755 (executable)
@@ -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
index c950c3ddf04a6d8a4b656d0ad7a61762e4dbc8d5..17d7c17b1e444ab8fac419c8f807e4a22b2779bd 100755 (executable)
@@ -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;
        }