[Libreoffice-commits] core.git: vcl/source
Armin Le Grand
Armin.Le.Grand at cib.de
Mon Aug 21 18:09:59 UTC 2017
vcl/source/filter/wmf/wmf.cxx | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
New commits:
commit b5f2402e023fb438341895ad0f81020571c5ec5a
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Mon Aug 21 18:34:32 2017 +0200
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 at libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>
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())
{
More information about the Libreoffice-commits
mailing list