summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-11-04 11:31:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-11-04 11:42:12 +0100
commit60b9c16bd482e43cfc5d70d807b84df442707a83 (patch)
treeadde40794e4d7648155badfadf1bad7009a356c1 /unotools
parent3829c0c7db8768ca05f148e8f5c271ddb56d5bae (diff)
fix potential out-of-bounds access in LocaleDataWrapper
after commit 86b345a963a64fd9b9a3cab522b3ac2e909977fd Date: Sat May 1 08:30:46 2021 +0200 tdf#79049 speed up OOXML workbook load (4) if the number of reserved words returned by the locale is not correct. Change-Id: I1c709060a5f4e24c4278f3c36310364d10545f14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124677 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 12a91d363ded..42b8027b3239 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -169,15 +169,12 @@ void LocaleDataWrapper::loadData()
try
{
- aReservedWordSeq = xLD->getReservedWord( rMyLocale );
+ aReservedWords = comphelper::sequenceToContainer<std::vector<OUString>>(xLD->getReservedWord( rMyLocale ));
}
catch ( const Exception& )
{
TOOLS_WARN_EXCEPTION( "unotools.i18n", "getReservedWord" );
- aReservedWordSeq = {};
}
- for (int i=0; i < css::i18n::reservedWords::COUNT; ++i)
- aReservedWord[i] = aReservedWordSeq[i];
try
{
@@ -378,12 +375,13 @@ const OUString& LocaleDataWrapper::getOneLocaleItem( sal_Int16 nItem ) const
const OUString& LocaleDataWrapper::getOneReservedWord( sal_Int16 nWord ) const
{
- if ( nWord < 0 || nWord >= reservedWords::COUNT )
+ if ( nWord < 0 || nWord >= static_cast<sal_Int16>(aReservedWords.size()) )
{
SAL_WARN( "unotools.i18n", "getOneReservedWord: bounds" );
- nWord = reservedWords::FALSE_WORD;
+ static const OUString EMPTY;
+ return EMPTY;
}
- return aReservedWord[nWord];
+ return aReservedWords[nWord];
}
MeasurementSystem LocaleDataWrapper::mapMeasurementStringToEnum( const OUString& rMS ) const