From 8a76ec713efeaa5196fec21e60c473993f132f42 Mon Sep 17 00:00:00 2001 From: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Date: Fri, 9 Jul 2021 12:41:43 -0500 Subject: [PATCH] Updated the SettingsRegistry Specialization tag name max size to 64 (#2016) The tag name max size should match the maximum size of a project name, since the project name is automatically added as a specialization tag in the settings registry when loading .setreg files from within the /Registry directory Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> --- .../AzCore/AzCore/Settings/SettingsRegistry.cpp | 9 +++++++++ Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.cpp b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.cpp index efbc0eaa1f..5a709f9324 100644 --- a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.cpp +++ b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.cpp @@ -32,6 +32,15 @@ namespace AZ { if (m_hashes.size() < m_hashes.max_size()) { + constexpr size_t MaxTagSize = TagName{}.max_size(); + if (specialization.size() > MaxTagSize) + { + AZ_Error("Settings Registry", false, R"(Cannot append Specialization tag of "%.*s.")" + " It is longer than the MaxTagNameSize of %zu", AZ_STRING_ARG(specialization), + MaxTagSize); + return false; + } + m_names.push_back(TagName{ specialization }); TagName& tag = m_names.back(); AZStd::to_lower(tag.begin(), tag.end()); diff --git a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.h b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.h index baeca89636..f0077db2ca 100644 --- a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.h +++ b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.h @@ -49,7 +49,7 @@ namespace AZ class Specializations { public: - static constexpr size_t MaxTagNameSize = 32; + static constexpr size_t MaxTagNameSize = 64; static constexpr size_t MaxCount = 15; static constexpr size_t NotFound = static_cast(-1); using TagName = AZStd::fixed_string;