[Libreoffice-commits] core.git: sw/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 31 07:18:18 UTC 2019


 sw/source/core/doc/DocumentFieldsManager.cxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit d32bed7af67b08037e063c4b85aaa46c55ff7781
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jul 29 09:16:32 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Jul 31 09:17:41 2019 +0200

    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 at redhat.com>

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);
+                        }
                     }
                 }
             }


More information about the Libreoffice-commits mailing list