summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-08-23 20:08:48 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-08-25 14:59:35 +0200
commit8f7b8a6c068c6484b05edb2aac643142df6d44ac (patch)
tree9a1aad564f075391e02a843bfa853ceef33e8c4a
parentofz: MemorySanitizer: use-of-uninitialized-value (diff)
downloadcore-8f7b8a6c068c6484b05edb2aac643142df6d44ac.tar.gz
core-8f7b8a6c068c6484b05edb2aac643142df6d44ac.zip
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@redhat.com> (cherry picked from commit 4556dd0f9d154c9b71b009f6dcf9f3e54d9a4d85) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120976 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--vcl/source/filter/ieps/ieps.cxx9
1 files changed, 5 insertions, 4 deletions
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);