[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sfx2/source sw/source writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Sat Apr 14 10:00:50 PDT 2012


 sfx2/source/doc/objstor.cxx                              |    2 +-
 sw/source/core/docnode/ndtbl.cxx                         |   10 +++++++++-
 sw/source/core/unocore/unotext.cxx                       |    4 ++++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    2 +-
 writerfilter/source/rtftok/rtftokenizer.cxx              |   10 ++++++++++
 5 files changed, 25 insertions(+), 3 deletions(-)

New commits:
commit 51c8c95b2864b49e7bcbd824eacedb5778a758c0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 14 12:45:38 2012 +0100

    Resolves: fdo#48640 handle various busted rtf docs without hanging
    
    (cherry picked from commit 234f150f30d881b2691288c5f5581306bd4d3d18)
    
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index b652fe6..7a43904 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2238,7 +2238,7 @@ sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium, bool bInsert )
         }
 
         return xLoader->filter( aArgs );
-        }catch(const uno::Exception&)
+        }catch(...)
         {}
     }
 
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index ba7581f..981f3c3 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1078,8 +1078,16 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
 
 const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes )
 {
+    if (rTableNodes.empty())
+        return NULL;
+
+    std::vector<SwNodeRange> rFirstRange = *rTableNodes.begin();
+
+    if (rFirstRange.empty())
+        return NULL;
+
     /* Save first node in the selection if it is a content node. */
-    SwCntntNode * pSttCntntNd = rTableNodes.begin()->begin()->aStart.GetNode().GetCntntNode();
+    SwCntntNode * pSttCntntNd = rFirstRange.begin()->aStart.GetNode().GetCntntNode();
 
     /**debug**/
 #if OSL_DEBUG_LEVEL > 1
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 71939e4..bd356da 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2231,6 +2231,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
     std::vector<VerticallyMergedCell> aMergedCells;
 
     SwTable const*const pTable = m_pImpl->m_pDoc->TextToTable( aTableNodes );
+
+    if (!pTable)
+        return uno::Reference< text::XTextTable >();
+
     SwXTextTable *const pTextTable = new SwXTextTable( *pTable->GetFrmFmt() );
     const uno::Reference< text::XTextTable > xRet = pTextTable;
     const uno::Reference< beans::XPropertySet > xPrSet = pTextTable;
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 2331e57..b4aaf3d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -442,7 +442,7 @@ void DomainMapperTableManager::endOfRowAction()
     double nFullWidth = m_nTableWidth;
     //the positions have to be distibuted in a range of 10000
     const double nFullWidthRelative = 10000.;
-    if( pTableGrid->size() == nGrids )
+    if( pTableGrid->size() == nGrids && m_nCell > 0 )
     {
         uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell - 1 );
         text::TableColumnSeparator* pSeparators = aSeparators.getArray();
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index 897e316..8a0f155 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -213,6 +213,11 @@ int RTFTokenizer::resolveKeyword()
     {
         aBuf.append(ch);
         Strm() >> ch;
+        if (Strm().IsEof())
+        {
+            ch = ' ';
+            break;
+        }
     }
     if (aBuf.getLength() > 32)
         // See RTF spec v1.9.1, page 7
@@ -237,6 +242,11 @@ int RTFTokenizer::resolveKeyword()
         {
             aParameter.append(ch);
             Strm() >> ch;
+            if (Strm().IsEof())
+            {
+                ch = ' ';
+                break;
+            }
         }
         nParam = aParameter.makeStringAndClear().toInt32();
         if (bNeg)


More information about the Libreoffice-commits mailing list