diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-04-18 09:38:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-04-18 20:24:51 +0200 |
commit | fbaeeee7ac09846099932c14fe78fb01a1b762b7 (patch) | |
tree | bd1f83bc3839400c3fe7a195fc00068119480163 /sc/source/core | |
parent | 86a8a3a43b642fc13bae6a89720496285f8f73d7 (diff) |
crashtesting: crash on export of forum-mso-en4-470772.xlsx to xlsx
similar fix as:
commit 1d5630c5deeec5dca724c29ec8c886bfa71a2099
Date: Tue Apr 16 15:21:49 2024 +0900
pivot: add checks that prevent reading out of vector bounds
Change-Id: I190da7586cff9c7e8dd4011ad61e68abba6ecd53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166240
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc/source/core')
-rw-r--r-- | sc/source/core/data/PivotTableFormatOutput.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sc/source/core/data/PivotTableFormatOutput.cxx b/sc/source/core/data/PivotTableFormatOutput.cxx index cdd2ac90914f..575fd5e77508 100644 --- a/sc/source/core/data/PivotTableFormatOutput.cxx +++ b/sc/source/core/data/PivotTableFormatOutput.cxx @@ -58,16 +58,13 @@ public: { std::vector<OUString> aNames; fillNamesForDimension(aNames, nDimension); - maNameCache.emplace(nDimension, aNames); - return aNames[nIndex]; - } - else - { - std::vector<OUString>& rNames = iterator->second; - if (nIndex >= rNames.size()) - return OUString(); - return rNames[nIndex]; + iterator = maNameCache.emplace(nDimension, aNames).first; } + + const std::vector<OUString>& rNames = iterator->second; + if (nIndex >= rNames.size()) + return OUString(); + return rNames[nIndex]; } }; |