diff options
author | Eike Rathke <erack@redhat.com> | 2017-01-06 17:38:39 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-01-06 18:29:16 +0100 |
commit | b36bf9f567f5b531f526dad6776c84e06203396f (patch) | |
tree | 3f40dc53b29f825efbcf53c5b5d8fdb40a90651a /formula | |
parent | d788d37a16d382d7ff32a19e8d65e5c605ac55dd (diff) |
check length of string as this can be called untokenized, tdf#105024 related
i.e. during import of ODFF
Change-Id: I7f5419d393f89d8a84efca7444e8dde3a3e9199f
Diffstat (limited to 'formula')
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 66c92fb08e3f..a271410d5a65 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1188,8 +1188,9 @@ FormulaError FormulaCompiler::GetErrorConstant( const OUString& rName ) const else { // Per convention recognize detailed "#ERRxxx!" constants, always - // untranslated. - if (rName.startsWithIgnoreAsciiCase("#ERR") && rName[rName.getLength()-1] == '!') + // untranslated. Error numbers are sal_uInt16 so at most 5 decimal + // digits. + if (rName.startsWithIgnoreAsciiCase("#ERR") && rName.getLength() <= 10 && rName[rName.getLength()-1] == '!') { sal_uInt32 nErr = rName.copy( 4, rName.getLength() - 5).toUInt32(); if (0 < nErr && nErr <= SAL_MAX_UINT16 && isPublishedFormulaError(static_cast<FormulaError>(nErr))) |