summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-07-29 09:16:32 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-07-31 09:17:41 +0200
commitd32bed7af67b08037e063c4b85aaa46c55ff7781 (patch)
treebeaab5b106d1eef5ac7bb642101d5a07fc220f09
parentb25284244a4a0e5ff480538133ee18f471a4bfc8 (diff)
Avoid -fsanitize=float-cast-overflow
...during `--convert-to pdf doc/ooo111446-1.doc` (i.e., attachment DirAppLaunch.docx at <https://bz.apache.org/ooo/show_bug.cgi?id=111446#c1>), when aNew is "fig figFuncBlocks=fig figFuncBlocks+1" causing aCalc.IsCalcError() (whether legitimately, or because there is some prior error importing that formula): > sw/source/core/fields/expfld.cxx:912:34: runtime error: 1.79769e+308 is outside the range of representable values of type 'unsigned int' > #0 in SwSetExpField::SetValue(double const&) at sw/source/core/fields/expfld.cxx:912:34 > #1 in SwSetExpField::SetValue(double const&, SwRootFrame const*) at sw/source/core/fields/expfld.cxx:922:9 > #2 in sw::DocumentFieldsManager::UpdateExpFieldsImpl(SwTextField*, SwRootFrame const*) at sw/source/core/doc/DocumentFieldsManager.cxx:1254:34 > #3 in sw::DocumentFieldsManager::UpdateExpFields(SwTextField*, bool) at sw/source/core/doc/DocumentFieldsManager.cxx:924:9 > #4 in SwViewShell::CalcLayout() at sw/source/core/view/viewsh.cxx:1024:46 > #5 in SwEditShell::CalcLayout() at sw/source/core/edit/edws.cxx:110:18 > #6 in SwXTextDocument::getRendererCount(com::sun::star::uno::Any const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sw/source/uibase/uno/unotxdoc.cxx:2595:25 > #7 in PDFExport::Export(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at filter/source/pdf/pdfexport.cxx:911:59 [...] Change-Id: I585bb9831212390b2c28248c3ff0904093b48783 Reviewed-on: https://gerrit.libreoffice.org/76520 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index c66b4ddd22a1..7f7a5b9e1c74 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1246,14 +1246,17 @@ void DocumentFieldsManager::UpdateExpFieldsImpl(
aNew += pSField->GetFormula();
SwSbxValue aValue = aCalc.Calculate( aNew );
- double nErg = aValue.GetDouble();
- // only update one field
- if( !aValue.IsVoidValue() && (!pUpdateField || pUpdateField == pTextField) )
+ if (!aCalc.IsCalcError())
{
- pSField->SetValue(nErg, pLayout);
+ double nErg = aValue.GetDouble();
+ // only update one field
+ if( !aValue.IsVoidValue() && (!pUpdateField || pUpdateField == pTextField) )
+ {
+ pSField->SetValue(nErg, pLayout);
- if( pSeqNd )
- pSFieldTyp->SetChapter(*pSField, *pSeqNd, pLayout);
+ if( pSeqNd )
+ pSFieldTyp->SetChapter(*pSField, *pSeqNd, pLayout);
+ }
}
}
}