[Libreoffice-commits] core.git: vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 24 07:35:35 UTC 2021


 vcl/source/filter/ieps/ieps.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 4556dd0f9d154c9b71b009f6dcf9f3e54d9a4d85
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 23 20:08:48 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 24 09:34:58 2021 +0200

    ofz: MemorySanitizer: use-of-uninitialized-value
    
    Change-Id: I364368cf4f5cb68c03bbff81f42002f56e3e44af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120923
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/filter/ieps/ieps.cxx b/vcl/source/filter/ieps/ieps.cxx
index 946fbf30b3d7..7b5a0c96dd10 100644
--- a/vcl/source/filter/ieps/ieps.cxx
+++ b/vcl/source/filter/ieps/ieps.cxx
@@ -635,11 +635,12 @@ bool ImportEpsGraphic( SvStream & rStream, Graphic & rGraphic)
         nPSSize = rStream.Seek( STREAM_SEEK_TO_END ) - nOrigPos;
     }
 
-    std::unique_ptr<sal_uInt8[]> pHeader( new sal_uInt8[ 22 ] );
+    std::vector<sal_uInt8> aHeader(22, 0);
     rStream.Seek( nPSStreamPos );
-    rStream.ReadBytes(pHeader.get(), 22); // check PostScript header
-    bool bOk = ImplSearchEntry(pHeader.get(), reinterpret_cast<sal_uInt8 const *>("%!PS-Adobe"), 10, 10) &&
-               ImplSearchEntry(&pHeader[ 15 ], reinterpret_cast<sal_uInt8 const *>("EPS"), 3, 3);
+    rStream.ReadBytes(aHeader.data(), 22); // check PostScript header
+    sal_uInt8* pHeader = aHeader.data();
+    bool bOk = ImplSearchEntry(pHeader, reinterpret_cast<sal_uInt8 const *>("%!PS-Adobe"), 10, 10) &&
+               ImplSearchEntry(pHeader + 15, reinterpret_cast<sal_uInt8 const *>("EPS"), 3, 3);
     if (bOk)
     {
         rStream.Seek(nPSStreamPos);


More information about the Libreoffice-commits mailing list