~aleteoryx/muditaos

27cf19317a9e96e456839e62ec0a7186f08ae55b — Bartosz 3 years ago 8109062
[MOS-765] Fixed crash on invalid ID3 tag

Bumped taglib version to latest master
Added sanity check for version field in tag parser in taglib
so in case of damaged/invalid tag it returns no tag at all

It was caused by zipped mp3 files and renamed to mp3 again
M module-audio/tags_fetcher/CMakeLists.txt => module-audio/tags_fetcher/CMakeLists.txt +1 -0
@@ 11,5 11,6 @@ target_sources(tagsfetcher
target_link_libraries(tagsfetcher
    PRIVATE
    tag
    module-utils
    Microsoft.GSL::GSL
)

M module-audio/tags_fetcher/TagsFetcher.cpp => module-audio/tags_fetcher/TagsFetcher.cpp +6 -6
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "TagsFetcher.hpp"


@@ 14,8 14,8 @@ namespace tags::fetcher
{
    std::optional<Tags> fetchTagsInternal(std::string filePath)
    {
        TagLib::FileRef tagReader(filePath.c_str());
        if (!tagReader.isNull() && tagReader.tag()) {
        TagLib::FileRef const tagReader(filePath.c_str());
        if (!tagReader.isNull() && (tagReader.tag() != nullptr)) {
            TagLib::Tag *tags                   = tagReader.tag();
            TagLib::AudioProperties *properties = tagReader.audioProperties();



@@ 24,8 24,8 @@ namespace tags::fetcher
            auto getTitle = [&]() -> std::string {
                const auto title = tags->title().to8Bit(unicode);
                // If title tag empty fill it with raw file name
                if (title.size() == 0) {
                    if (const auto pos = filePath.rfind("/"); pos == std::string::npos) {
                if (title.empty()) {
                    if (const auto pos = filePath.rfind('/'); pos == std::string::npos) {
                        return filePath;
                    }
                    else {


@@ 71,7 71,7 @@ namespace tags::fetcher
        return {};
    }

    Tags fetchTags(std::string filePath)
    Tags fetchTags(const std::string &filePath)
    {
        return fetchTagsInternal(filePath).value_or(Tags{filePath});
    }

M module-audio/tags_fetcher/TagsFetcher.hpp => module-audio/tags_fetcher/TagsFetcher.hpp +2 -2
@@ 1,5 1,5 @@

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 64,5 64,5 @@ namespace tags::fetcher
        {}
    };

    Tags fetchTags(std::string fileName);
    Tags fetchTags(const std::string &fileName);
} // namespace tags::fetcher

M pure_changelog.md => pure_changelog.md +1 -0
@@ 11,6 11,7 @@
* Fixed notes window title
* Fixed adding and deleting country code prefix to existing contact
* Fixed French translation for SIM cards texts
* Fixed crash on music file with invalid tags

### Added


M third-party/taglib => third-party/taglib +1 -1
@@ 1,1 1,1 @@
Subproject commit c68017ab5a9e494ae837075ef007ac6791955fe1
Subproject commit f700e74025f56de2d35ef0c2a460f0ee2abaa034