summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-07-26 16:35:43 +0100
committerPetr Mladek <pmladek@suse.cz>2012-07-27 11:25:49 +0200
commitc121e9149374e3b56e35301db1d1bafb513b2dff (patch)
treee8d9cc780d163f433f684d8c25713c17330a8432
parenteb84b4678a16cc48f1fdb21098b1fc978800a83e (diff)
discard broken embedded object previews
Change-Id: I4f632545d383c4887342aa2959987d4ac3638eb4 Signed-off-by: Petr Mladek <pmladek@suse.cz> Signed-off-by: Jan Holesovsky <kendy@suse.cz> Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
-rw-r--r--svtools/source/misc/embedhlp.cxx25
1 files changed, 17 insertions, 8 deletions
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 6325a76c4ec3..135ad3055500 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -560,16 +560,25 @@ SvStream* EmbeddedObjectRef::GetGraphicStream( sal_Bool bUpdate ) const
{
const sal_Int32 nConstBufferSize = 32000;
SvStream *pStream = new SvMemoryStream( 32000, 32000 );
- sal_Int32 nRead=0;
- uno::Sequence < sal_Int8 > aSequence ( nConstBufferSize );
- do
+ try
+ {
+ sal_Int32 nRead=0;
+ uno::Sequence < sal_Int8 > aSequence ( nConstBufferSize );
+ do
+ {
+ nRead = xStream->readBytes ( aSequence, nConstBufferSize );
+ pStream->Write( aSequence.getConstArray(), nRead );
+ }
+ while ( nRead == nConstBufferSize );
+ pStream->Seek(0);
+ return pStream;
+ }
+ catch (const uno::Exception& ex)
{
- nRead = xStream->readBytes ( aSequence, nConstBufferSize );
- pStream->Write( aSequence.getConstArray(), nRead );
+ SAL_WARN("svtools", "discarding broken embedded object preview: " << ex.Message);
+ delete pStream;
+ xStream.clear();
}
- while ( nRead == nConstBufferSize );
- pStream->Seek(0);
- return pStream;
}
}