diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2014-07-14 23:55:04 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-07-22 11:43:40 +0200 |
commit | 477b5bda14c781ec6b2afb3590e4f66c85e1c62a (patch) | |
tree | 93de80433b1de293bb437af8c9191dd25914ec1c | |
parent | 0c45ed0a36432f5eff877e011fa4a3fa53518dca (diff) |
fdo#81284 Don't write to zero length files
Change-Id: I4eddcda3977f43b39abdaa8d9089ff661092361c
Reviewed-on: https://gerrit.libreoffice.org/10310
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | sd/source/ui/unoidl/sddetect.cxx | 6 | ||||
-rw-r--r-- | starmath/source/smdetect.cxx | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx index e8ee02e0398a..161d11fb7791 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 ca9453ad09c7..c943bee91e23 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() ) { |