summaryrefslogtreecommitdiff
path: root/vcl/source/filter
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2017-08-21 18:34:32 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2017-08-21 20:07:49 +0200
commitb5f2402e023fb438341895ad0f81020571c5ec5a (patch)
tree7d0a079f361ebd7a48b31ec1fe18fd7f621d761b /vcl/source/filter
parentcd65bae41c52c4d2f40589776a645e224ee222cd (diff)
emfplus: Corrected ReadWindowMetafile
There are two places which do hand over not a complete SvStream staring at pos zero, but pass a seek position indirectly in that stream. Thus this needs to be used. There is one usage in sc that copies the data to a MemStream to avoid that, so this hints that this 'trap/feature' was not known to everyone using it Change-Id: I94139b86c8bdd82879124c574bc3014e02d9ab5f Reviewed-on: https://gerrit.libreoffice.org/41399 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'vcl/source/filter')
-rw-r--r--vcl/source/filter/wmf/wmf.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx
index fe9a9f4429ca..ac56c74810f4 100644
--- a/vcl/source/filter/wmf/wmf.cxx
+++ b/vcl/source/filter/wmf/wmf.cxx
@@ -25,12 +25,25 @@
bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF )
{
- // Use new method to import Metafile. First, read binary data to mem array
- const sal_uInt32 nStreamLength(rStream.Seek(STREAM_SEEK_TO_END));
+ // tdf#111484 Use new method to import Metafile. Take curent StreamPos
+ // into account (used by SwWW8ImplReader::ReadGrafFile and by
+ // SwWw6ReadMetaStream, so do *not* ignore. OTOH XclImpDrawing::ReadWmf
+ // is nice enough to copy to an own MemStream to avoid that indirect
+ // parameter passing...)
+ const sal_uInt32 nStreamStart(rStream.Tell());
+ const sal_uInt32 nStreamEnd(rStream.Seek(STREAM_SEEK_TO_END));
+
+ if (nStreamStart >= nStreamEnd)
+ {
+ return false;
+ }
+
+ // Read binary data to mem array
+ const sal_uInt32 nStreamLength(nStreamEnd - nStreamStart);
VectorGraphicDataArray aNewData(nStreamLength);
- rStream.Seek(0);
+ rStream.Seek(nStreamStart);
rStream.ReadBytes(aNewData.begin(), nStreamLength);
- rStream.Seek(0);
+ rStream.Seek(nStreamStart);
if (rStream.good())
{