summaryrefslogtreecommitdiff
path: root/sd/source/ui/unoidl
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2014-02-25 14:16:25 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-02-25 16:23:32 +0000
commit27c3b8bca22353dfdcf4c248539a727522fc4e76 (patch)
tree6e56d23130f59cb7c5c41012bc81578f205426d5 /sd/source/ui/unoidl
parentb8ebdae0345aa331cf6d6dabf40a6f26dc7d2371 (diff)
Don't write compound header to zero length files
Change-Id: Ie964ca8b870714d1c3e92469a771fab9a71f0633 Reviewed-on: https://gerrit.libreoffice.org/8220 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/source/ui/unoidl')
-rw-r--r--sd/source/ui/unoidl/sddetect.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx
index 853c38e9f2d0..2ec197365197 100644
--- a/sd/source/ui/unoidl/sddetect.cxx
+++ b/sd/source/ui/unoidl/sddetect.cxx
@@ -352,6 +352,17 @@ OUString SAL_CALL SdFilterDetect::detect( Sequence< beans::PropertyValue >& lDes
pStm = aMedium.GetInStream();
if (!pStm)
pFilter = NULL;
+
+ pStm->Seek(STREAM_SEEK_TO_END);
+ const sal_Size nSize = pStm->Tell();
+ pStm->Seek(STREAM_SEEK_TO_BEGIN);
+
+ // Do not attempt to create an SotStorage on a
+ // 0-length stream as that would create the compound
+ // document header on the stream and effectively write to
+ // disk!
+ if (!nSize)
+ pFilter = NULL;
}
if (pFilter && pStm)