forms/source/misc/limitedformats.cxx | 6 ++++++ 1 file changed, 6 insertions(+)
New commits: commit 2a20a894b0752e5b7f28547ed9a90570739e8bea Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Jul 17 14:49:13 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Jul 17 18:25:54 2024 +0200 cid#1608071 Out-of-bounds access Change-Id: Ia258bb10c015150f3ff8f978e975a033e981aa92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170633 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/forms/source/misc/limitedformats.cxx b/forms/source/misc/limitedformats.cxx index e899128aa5e8..c40de6b23430 100644 --- a/forms/source/misc/limitedformats.cxx +++ b/forms/source/misc/limitedformats.cxx @@ -18,6 +18,7 @@ */ #include <limitedformats.hxx> +#include <sal/log.hxx> #include <osl/diagnose.h> #include <comphelper/types.hxx> #include <comphelper/extract.hxx> @@ -266,6 +267,11 @@ namespace frm Any aEnumPropertyValue = m_xAggregate->getFastPropertyValue(m_nFormatEnumPropertyHandle); sal_Int32 nOldEnumValue = -1; ::cppu::enum2int(nOldEnumValue, aEnumPropertyValue); + if (nOldEnumValue < 0) + { + SAL_WARN("forms.misc", "Negative OldEnumValue!"); + return false; + } // get the translation table std::span<FormatEntry> pFormats = lcl_getFormatTable(m_nTableId);