diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-12-24 21:49:23 +0200 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2016-01-06 08:43:12 +0000 |
commit | 22383b1002a63084be91d29ebff229cffdd6cf97 (patch) | |
tree | 271bd6018e998a48f4b018dcb554815bb6ab59f5 | |
parent | 537c7dcfc1e2a1a8ebd9ef12f5671725c7d5e014 (diff) |
tdf#96713 OdfFlatXml: Seek to 0 before reading
Similar to tdf#45418.
The problem is that sfx2 DocumentInserter code calls SfxMedium::IsStorage,
which reads the stream but doesn't correctly seek back to 0. Actually
SfxMedium_Impl has 2 members for the input stream, one of SvStream type
and another one as Reference<XInputStream>. Turns out that reading with
SvStream::Read changes the position in the object referenced by
Reference<XInputStream>, but SvStream::Seek doesn't, so Seek(0) doesn't
do the desired effect.
My current solution is to ensure that we're reading from 0 inside the
filter. I think it's a good thing to do anyway, and should be sufficient,
given that other filters doesn't seem to be affected by this bug.
Change-Id: I49b41077032d3e395c675e4f7824cc778c075473
(cherry picked from commit 5e4124396cafc2b0a435f17a66b33e36303ae4e4)
Reviewed-on: https://gerrit.libreoffice.org/20969
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | filter/source/odfflatxml/OdfFlatXml.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx index 8022178efd2b..2d32977ae9c7 100644 --- a/filter/source/odfflatxml/OdfFlatXml.cxx +++ b/filter/source/odfflatxml/OdfFlatXml.cxx @@ -147,6 +147,10 @@ OdfFlatXml::importer( saxParser->setDocumentHandler(docHandler); try { + css::uno::Reference< css::io::XSeekable > xSeekable( inputStream, css::uno::UNO_QUERY ); + if ( xSeekable.is() ) + xSeekable->seek( 0 ); + saxParser->parseStream(inputSource); } catch (const Exception &exc) |