diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-02-23 21:12:41 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-02-24 09:04:39 +0000 |
commit | 9ac308b99e37c228f2ef1cfa3e2b847ff7361f9a (patch) | |
tree | 58461c936a8a841a8ad855d25ba9ff697e81cfa5 | |
parent | 4b9cc680162d441d6d99d726792d5f902f46e879 (diff) |
crashtesting: null-deref seen on loading forum-mso-en4-399427.xlsx
and others. A problem since:
commit 8c9a6abf30e9ff1ebd5647f7c271e0d64643860a
Date: Thu Feb 2 20:16:04 2023 +0100
tdf#138601 XLSX import: fix priority of conditional formatting rules
Change-Id: I663b193c5bd7c5c92d3c423e70b0f7a24e3e5d76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147592
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 1abb3bf91938..ac5c2738aa47 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1172,11 +1172,12 @@ void CondFormatBuffer::finalizeImport() minIndex = i; for (size_t j = i + 1; j < maCondFormats.size(); ++j) { - if (maCondFormats[j]->maRules.begin()->first - < maCondFormats[minIndex]->maRules.begin()->first) - { + const CondFormat::CondFormatRuleMap& rNextRules = maCondFormats[j]->maRules; + const CondFormat::CondFormatRuleMap& rMinRules = maCondFormats[minIndex]->maRules; + if (rNextRules.empty() || rMinRules.empty()) + continue; + if (rNextRules.begin()->first < rMinRules.begin()->first) minIndex = j; - } } if (i != minIndex) std::swap(maCondFormats[i], maCondFormats[minIndex]); |