From 477b5bda14c781ec6b2afb3590e4f66c85e1c62a Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Mon, 14 Jul 2014 23:55:04 +0300 Subject: fdo#81284 Don't write to zero length files Change-Id: I4eddcda3977f43b39abdaa8d9089ff661092361c Reviewed-on: https://gerrit.libreoffice.org/10310 Reviewed-by: David Tardon Tested-by: David Tardon --- starmath/source/smdetect.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'starmath') diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index ca9453ad09c7..c943bee91e23 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -296,7 +296,15 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor //this approach, to be fixed at a better level than here SvStream *pStrm = aMedium.GetInStream(); aTypeName = OUString(); + + sal_Size nStreamSize = 0; if (pStrm && !pStrm->GetError()) + { + pStrm->Seek( STREAM_SEEK_TO_BEGIN ); + nStreamSize = pStrm->remainingSize(); + } + + if ( nStreamSize > 0 ) { SotStorageRef aStorage = new SotStorage ( pStrm, sal_False ); if ( !aStorage->GetError() ) -- cgit v1.2.3