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

This commit is contained in:
Caolán McNamara 2012-04-14 12:45:38 +01:00
parent 1856186951
commit 234f150f30
5 changed files with 25 additions and 3 deletions

View file

@ -2236,7 +2236,7 @@ sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium, bool bInsert )
}
return xLoader->filter( aArgs );
}catch(const uno::Exception&)
}catch(...)
{}
}

View file

@ -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

View file

@ -2230,6 +2230,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;

View file

@ -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();

View file

@ -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)