cui/source/options/appearance.cxx |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

New commits:
commit e019575b64c4e33d4133ff10d45bedb9daa59cd2
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Dec 22 12:57:11 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Dec 22 15:38:27 2024 +0100

    cid#1636855 Out-of-bounds read
    
    Change-Id: Id2573d678b0059c1929d1a896cbfdf863676f945
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179142
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/cui/source/options/appearance.cxx 
b/cui/source/options/appearance.cxx
index cd7d33ca5058..fa70705ab327 100644
--- a/cui/source/options/appearance.cxx
+++ b/cui/source/options/appearance.cxx
@@ -230,6 +230,9 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, ShowInDocumentHdl, 
weld::Toggleable&, void
 {
     // get selected entry index and ColorConfigValue
     ColorConfigEntry nEntry = GetActiveEntry();
+    if (nEntry == ColorConfigEntryCount)
+        return;
+
     ColorConfigValue aCurrentEntryColor = pColorConfig->GetColorValue(nEntry);
 
     // set colorconfig value
@@ -254,6 +257,9 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, ColorEntryChgHdl, 
weld::ComboBox&, void)
 {
     // get selected entry index and ColorConfigValue
     ColorConfigEntry nEntry = GetActiveEntry();
+    if (nEntry == ColorConfigEntryCount)
+        return;
+
     const ColorConfigValue& rCurrentEntryColor = 
pColorConfig->GetColorValue(nEntry);
 
     // set automatic colors
@@ -304,6 +310,9 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, ColorValueChgHdl, 
ColorListBox&, void)
 {
     // get the active entry
     ColorConfigEntry nEntry = GetActiveEntry();
+    if (nEntry == ColorConfigEntryCount)
+        return;
+
     ColorConfigValue aCurrentEntryColor = pColorConfig->GetColorValue(nEntry);
 
     // restart only for the UI colors
@@ -405,6 +414,9 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, ColorImageToggleHdl, 
weld::Toggleable&, vo
 {
     // get the active entry
     ColorConfigEntry nEntry = GetActiveEntry();
+    if (nEntry == ColorConfigEntryCount)
+        return;
+
     ColorConfigValue aCurrentEntryColor = pColorConfig->GetColorValue(nEntry);
 
     aCurrentEntryColor.bUseBitmapBackground = !m_xColorRadioBtn->get_active();
@@ -416,6 +428,9 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, 
StretchedTiledToggleHdl, weld::Toggleable&
 {
     // get the active entry
     ColorConfigEntry nEntry = GetActiveEntry();
+    if (nEntry == ColorConfigEntryCount)
+        return;
+
     ColorConfigValue aCurrentEntryColor = pColorConfig->GetColorValue(nEntry);
 
     aCurrentEntryColor.bIsBitmapStretched = m_xStretchedRadioBtn->get_active();
@@ -428,6 +443,9 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, BitmapChangeHdl, 
weld::ComboBox&, void)
 {
     // get the active entry
     ColorConfigEntry nEntry = GetActiveEntry();
+    if (nEntry == ColorConfigEntryCount)
+        return;
+
     ColorConfigValue aCurrentEntryColor = pColorConfig->GetColorValue(nEntry);
 
     // save the bitmap file name
@@ -543,6 +561,9 @@ void SvxAppearanceTabPage::UpdateColorDropdown()
 
     // update color to light/dark
     ColorConfigEntry nEntry = GetActiveEntry();
+    if (nEntry == ColorConfigEntryCount)
+        return;
+
     const ColorConfigValue& rCurrentEntryColor = 
pColorConfig->GetColorValue(nEntry);
 
     // set automatic colors

Reply via email to