Kaydet (Commit) 234f150f authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#48640 handle various busted rtf docs without hanging

üst 18561869
...@@ -2236,7 +2236,7 @@ sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium, bool bInsert ) ...@@ -2236,7 +2236,7 @@ sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium, bool bInsert )
} }
return xLoader->filter( aArgs ); return xLoader->filter( aArgs );
}catch(const uno::Exception&) }catch(...)
{} {}
} }
......
...@@ -1078,8 +1078,16 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, ...@@ -1078,8 +1078,16 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes ) 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. */ /* 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**/ /**debug**/
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
......
...@@ -2230,6 +2230,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) ...@@ -2230,6 +2230,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
std::vector<VerticallyMergedCell> aMergedCells; std::vector<VerticallyMergedCell> aMergedCells;
SwTable const*const pTable = m_pImpl->m_pDoc->TextToTable( aTableNodes ); SwTable const*const pTable = m_pImpl->m_pDoc->TextToTable( aTableNodes );
if (!pTable)
return uno::Reference< text::XTextTable >();
SwXTextTable *const pTextTable = new SwXTextTable( *pTable->GetFrmFmt() ); SwXTextTable *const pTextTable = new SwXTextTable( *pTable->GetFrmFmt() );
const uno::Reference< text::XTextTable > xRet = pTextTable; const uno::Reference< text::XTextTable > xRet = pTextTable;
const uno::Reference< beans::XPropertySet > xPrSet = pTextTable; const uno::Reference< beans::XPropertySet > xPrSet = pTextTable;
......
...@@ -442,7 +442,7 @@ void DomainMapperTableManager::endOfRowAction() ...@@ -442,7 +442,7 @@ void DomainMapperTableManager::endOfRowAction()
double nFullWidth = m_nTableWidth; double nFullWidth = m_nTableWidth;
//the positions have to be distibuted in a range of 10000 //the positions have to be distibuted in a range of 10000
const double nFullWidthRelative = 10000.; const double nFullWidthRelative = 10000.;
if( pTableGrid->size() == nGrids ) if( pTableGrid->size() == nGrids && m_nCell > 0 )
{ {
uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell - 1 ); uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell - 1 );
text::TableColumnSeparator* pSeparators = aSeparators.getArray(); text::TableColumnSeparator* pSeparators = aSeparators.getArray();
......
...@@ -213,6 +213,11 @@ int RTFTokenizer::resolveKeyword() ...@@ -213,6 +213,11 @@ int RTFTokenizer::resolveKeyword()
{ {
aBuf.append(ch); aBuf.append(ch);
Strm() >> ch; Strm() >> ch;
if (Strm().IsEof())
{
ch = ' ';
break;
}
} }
if (aBuf.getLength() > 32) if (aBuf.getLength() > 32)
// See RTF spec v1.9.1, page 7 // See RTF spec v1.9.1, page 7
...@@ -237,6 +242,11 @@ int RTFTokenizer::resolveKeyword() ...@@ -237,6 +242,11 @@ int RTFTokenizer::resolveKeyword()
{ {
aParameter.append(ch); aParameter.append(ch);
Strm() >> ch; Strm() >> ch;
if (Strm().IsEof())
{
ch = ' ';
break;
}
} }
nParam = aParameter.makeStringAndClear().toInt32(); nParam = aParameter.makeStringAndClear().toInt32();
if (bNeg) if (bNeg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment