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

Caolán McNamara caolanm at redhat.com
Fri Dec 18 03:49:06 PST 2015


 lotuswordpro/source/filter/lwpdivinfo.cxx     |    8 ++------
 lotuswordpro/source/filter/lwpfont.cxx        |    2 +-
 lotuswordpro/source/filter/lwptablelayout.cxx |    4 ++--
 lotuswordpro/source/filter/lwptblformula.cxx  |    2 +-
 4 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 742bcd2b2d23ae05bfcf356db69f79f33d20f53f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 18 11:48:02 2015 +0000

    crashtesting: these can happen with broken documents
    
    Change-Id: I35f77345804b3ebfda9d427de79968b193d1419a

diff --git a/lotuswordpro/source/filter/lwpdivinfo.cxx b/lotuswordpro/source/filter/lwpdivinfo.cxx
index 2f9a6cf..efa32f6 100644
--- a/lotuswordpro/source/filter/lwpdivinfo.cxx
+++ b/lotuswordpro/source/filter/lwpdivinfo.cxx
@@ -108,15 +108,11 @@ void LwpDivInfo::Read()
     m_FillerPageTextID.ReadIndexed(m_pObjStrm);
 
     // read external file object stuff
-#if !defined(NDEBUG)
-    sal_uInt16 type =
-#endif
-    m_pObjStrm->QuickReaduInt16();
+    sal_uInt16 type = m_pObjStrm->QuickReaduInt16();
     //cpExternalFile = LNULL;
 
-    assert(type==0);
+    SAL_WARN_IF(type != 0, "lwp", "should be 0");
     m_pObjStrm->SkipExtra();
-
 }
 
 void LwpDivInfo::SkipFront()
diff --git a/lotuswordpro/source/filter/lwpfont.cxx b/lotuswordpro/source/filter/lwpfont.cxx
index 5e0d274..8805533 100644
--- a/lotuswordpro/source/filter/lwpfont.cxx
+++ b/lotuswordpro/source/filter/lwpfont.cxx
@@ -262,7 +262,7 @@ void LwpFontTable::Read(LwpObjectStream *pStrm)
 
 OUString LwpFontTable::GetFaceName(sal_uInt16 index) //index: start from 1
 {
-    assert(index <= m_nCount && index > 0);
+    SAL_WARN_IF(index > m_nCount || index <= 0, "lwp", "bad font index");
     return (index <= m_nCount && index > 0) ? m_pFontEntries[index-1].GetFaceName() : OUString();
 }
 
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 385baa6..0faf772 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -215,13 +215,13 @@ double LwpSuperTableLayout::GetTableWidth()
         LwpTableLayout* pTableLayout = GetTableLayout();
         if(!pTableLayout)
         {
-            assert(false);
+            SAL_WARN("lwp", "missing table layout, early return");
             return 0;
         }
         LwpTable *pTable = pTableLayout->GetTable();
         if(!pTable)
         {
-            assert(false);
+            SAL_WARN("lwp", "missing table, early return");
             return 0;
         }
         double dDefaultWidth = pTable->GetWidth();
diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx
index 6f699c5..7a28a6e 100644
--- a/lotuswordpro/source/filter/lwptblformula.cxx
+++ b/lotuswordpro/source/filter/lwptblformula.cxx
@@ -342,7 +342,7 @@ void LwpFormulaInfo::Read()
         }
         else
         {
-            assert(false);
+            SAL_WARN("lwp", "missing row list");
         }
     }
     m_pObjStrm->SeekRel(2);//flags, size in file: sal_uInt16


More information about the Libreoffice-commits mailing list