svx/source/tbxctrls/PaletteManager.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2164a6b67948e3878727f8cc510d92bdc38f3268
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Jan 12 09:03:59 2024 +0100
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri Jan 12 14:19:09 2024 +0100

    PaletteManager::generateJSON sync with master
    
    Solves possible use-after-free catched by master Jenkins:
    
    In function ‘C* rtl::addDataHelper(C*, const C*, std::size_t) [with C = 
char16_t]’,
        inlined from ‘C* rtl::ToStringHelper<std::basic_string_view<C> 
>::operator()(C*, std::basic_string_view<C>) const [with C = char16_t]’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/stringconcat.hxx:365:27,
        inlined from ‘C* rtl::StringConcat<C, T1, T2, <anonymous> 
>::addData(C*) const [with C = char16_t; T1 = std::basic_string_view<char16_t>; 
T2 = rtl::StringNumber<char16_t, 65>; typename 
std::enable_if<(allowStringConcat<C, T1> && allowStringConcat<C, T2>), 
int>::type <anonymous> = 0]’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/stringconcat.hxx:195:86,
        inlined from ‘rtl::OUString::OUString(rtl::OUStringConcat<T1, T2>&&) 
[with T1 = std::basic_string_view<char16_t>; T2 = rtl::StringNumber<char16_t, 
65>]’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/ustring.hxx:499:41,
        inlined from ‘static void 
PaletteManager::generateJSON(boost::property_tree::ptree&, const 
std::set<Color>&)’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/svx/source/tbxctrls/PaletteManager.cxx:487:74:
    
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/stringconcat.hxx:80:15:
 error: pointer may be used after ‘void operator delete [](void*)’ 
[-Werror=use-after-free]
    
    Change-Id: Id79fdc3705194c9fd66f6be399f320e516515247
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161953
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/svx/source/tbxctrls/PaletteManager.cxx 
b/svx/source/tbxctrls/PaletteManager.cxx
index a807b6516789..0ba97a76ada4 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -471,6 +471,7 @@ void 
PaletteManager::generateJSON(boost::property_tree::ptree& aTree, const std:
 
     const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
     sal_uInt32 nColumnCount = rStyleSettings.GetColorValueSetColumnCount();
+    const OUString 
aNamePrefix(Concat2View(SvxResId(RID_SVXSTR_DOC_COLOR_PREFIX) + " "));
 
     auto aColorIt = rColors.begin();
     while (aColorIt != rColors.end())
@@ -480,7 +481,6 @@ void 
PaletteManager::generateJSON(boost::property_tree::ptree& aTree, const std:
         for (sal_uInt32 nColumn = 0; nColumn < nColumnCount; nColumn++)
         {
             boost::property_tree::ptree aColorTree;
-            std::u16string_view aNamePrefix = 
Concat2View(SvxResId(RID_SVXSTR_DOC_COLOR_PREFIX) + " ");
             OUString sName = aNamePrefix + OUString::number(nStartIndex++);
             aColorTree.put("Value", aColorIt->AsRGBHexString().toUtf8());
             aColorTree.put("Name", sName);

Reply via email to