From 052afc10c565940fa947e56c49e132aeb94ae03c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 5 Sep 2021 09:33:47 +0100 Subject: ofz: MemorySanitizer: use-of-uninitialized-value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib63d500480a78a144b127c4230542507132d0a5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121669 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/source/filter/ipict/ipict.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'vcl') diff --git a/vcl/source/filter/ipict/ipict.cxx b/vcl/source/filter/ipict/ipict.cxx index 8c9494c36448..d434763dd4be 100644 --- a/vcl/source/filter/ipict/ipict.cxx +++ b/vcl/source/filter/ipict/ipict.cxx @@ -1602,8 +1602,6 @@ sal_uInt64 PictReader::ReadData(sal_uInt16 nOpcode) break; case 0x002c: { // fontName - char sFName[ 256 ], nByteLen; - sal_uInt16 nLen; pPict->ReadUInt16( nUSHORT ); nDataSize=nUSHORT+2; pPict->ReadUInt16( nUSHORT ); if (nUSHORT <= 1) aActFont.SetFamily(FAMILY_SWISS); @@ -1614,9 +1612,11 @@ sal_uInt64 PictReader::ReadData(sal_uInt16 nOpcode) else if (nUSHORT <= 1023) aActFont.SetFamily(FAMILY_SWISS); else aActFont.SetFamily(FAMILY_ROMAN); aActFont.SetCharSet(GetTextEncoding(nUSHORT)); - pPict->ReadChar( nByteLen ); nLen=static_cast(nByteLen)&0x00ff; - pPict->ReadBytes(&sFName, nLen); - sFName[ nLen ] = 0; + char nByteLen(0); + pPict->ReadChar( nByteLen ); + sal_uInt16 nLen = static_cast(nByteLen)&0x00ff; + char sFName[ 256 ]; + sFName[pPict->ReadBytes(sFName, nLen)] = 0; OUString aString( sFName, strlen(sFName), osl_getThreadTextEncoding() ); aActFont.SetFamilyName( aString ); eActMethod = PictDrawingMethod::UNDEFINED; -- cgit