[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - svl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Jan 17 16:42:22 UTC 2019
svl/source/numbers/zforlist.cxx | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 7fcab5877558c23c8772c07fc9af00f2c3dd7a84
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Wed Jan 16 18:19:54 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jan 17 17:41:56 2019 +0100
Related: tdf#122509 prevent access of not existing base format
Call to pFormat->HasPositiveBracketPlaceholder() with nullptr as
obtained for the not existing nIndex was the immediate cause of
the crash.
Also obtain the type from the format if found instead of the
separate GetType() call that again would need to find the format
first. This clarifies that the other places accessing pFormat
don't need additional checks because eType isn't UNDEFINED there.
Reviewed-on: https://gerrit.libreoffice.org/66476
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins
(cherry picked from commit d807d6a65f439da88623e45b1dabe7d9ef36cd3c)
According to
https://crashreport.libreoffice.org/stats/signature/SvNumberformat::HasPositiveBracketPlaceholder()
this occasionally happened in ~all releases, independent of the
circumstances in tdf#122509, so let's backport to available release.
Change-Id: I5d78ad73eeb4c3820c45d6a91b0e729ed22951a4
Reviewed-on: https://gerrit.libreoffice.org/66521
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 9d4a630df51b..3da7ab43c449 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -2855,7 +2855,10 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
{
eLnge = IniLnge;
}
- SvNumFormatType eType = GetType(nIndex);
+
+ const SvNumberformat* pFormat = GetFormatEntry( nIndex );
+ const SvNumFormatType eType = (pFormat ? pFormat->GetMaskedType() : SvNumFormatType::UNDEFINED);
+
ImpGenerateCL(eLnge); // create new standard formats if necessary
utl::DigitGroupingIterator aGrouping( xLocaleData->getDigitGrouping());
@@ -2863,8 +2866,6 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
const sal_Int32 nDigitsInFirstGroup = ( bThousand && (eType == SvNumFormatType::SCIENTIFIC) ) ? 3 : aGrouping.get();
const OUString& rThSep = GetNumThousandSep();
- SvNumberformat* pFormat = GetFormatEntry( nIndex );
-
OUStringBuffer sString;
using comphelper::string::padToLength;
@@ -3012,7 +3013,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
{
OUStringBuffer sTmpStr(sString);
- if ( pFormat->HasPositiveBracketPlaceholder() )
+ if (pFormat && pFormat->HasPositiveBracketPlaceholder())
{
sTmpStr.append('_');
sTmpStr.append(')');
More information about the Libreoffice-commits
mailing list