vcl/source/filter/graphicfilter.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cf804594215550379e092ef8dca8c9d8308c987c
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat May 7 20:00:53 2022 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat May 7 22:53:01 2022 +0200

    ofz#47289 attempt to allocate negative len
    
    a problem since...
    
    commit e9c50fbbc3b07ef927d133da9cf2395c55611e0f
    Date:   Sat Apr 2 15:49:32 2022 +0300
    
        tdf#103954: Z compressed graphic formats support for EMF/WMF
    
    which added an unconditional seek to 0 of the stream which isn't
    desirable when done on the original stream which is deliberately
    seeked to the start of the graphic data, seeking to 0 just skips
    back to the start of the enclosing file, e.g. a word document stream.
    
    Presumably this should just happen in the case of the replacement
    decompressed stream.
    
    Change-Id: Ifb67fb265c70d5728a74dc3499f275eb5d69ddbb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133991
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index 68a2418fed58..9651861655b6 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1177,10 +1177,10 @@ ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, 
Graphic & rGraphic, GfxLi
         aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true);
         nStreamLength = aCodec.Decompress(rStream, aMemStream);
         aCodec.EndCompression();
+        aMemStream.Seek(STREAM_SEEK_TO_BEGIN);
         aNewStream = &aMemStream;
     }
     VectorGraphicDataArray aNewData(nStreamLength);
-    aNewStream->Seek(STREAM_SEEK_TO_BEGIN);
     aNewStream->ReadBytes(aNewData.getArray(), nStreamLength);
     if (!aNewStream->GetError())
     {

Reply via email to