[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sd/source starmath/source
Maxim Monastirsky
momonasmon at gmail.com
Tue Jul 15 02:55:17 PDT 2014
sd/source/ui/unoidl/sddetect.cxx | 6 ++++++
starmath/source/smdetect.cxx | 8 ++++++++
2 files changed, 14 insertions(+)
New commits:
commit 70c5401aa3b063d0f275042a48a54f42c1f54c03
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Jul 14 23:55:04 2014 +0300
fdo#81284 Don't write to zero length files
Change-Id: I4eddcda3977f43b39abdaa8d9089ff661092361c
Reviewed-on: https://gerrit.libreoffice.org/10310
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx
index e8ee02e..161d11f 100644
--- a/sd/source/ui/unoidl/sddetect.cxx
+++ b/sd/source/ui/unoidl/sddetect.cxx
@@ -351,6 +351,12 @@ OUString SAL_CALL SdFilterDetect::detect( Sequence< beans::PropertyValue >& lDes
pStm = aMedium.GetInStream();
if (!pStm)
pFilter = NULL;
+ else
+ {
+ pStm->Seek( STREAM_SEEK_TO_BEGIN );
+ if (pStm->remainingSize() == 0)
+ pFilter = NULL;
+ }
}
if (pFilter && pStm)
diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx
index ca9453a..c943bee 100644
--- a/starmath/source/smdetect.cxx
+++ b/starmath/source/smdetect.cxx
@@ -296,8 +296,16 @@ 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() )
{
More information about the Libreoffice-commits
mailing list