From 5b32ba4217e88f3f6fab0baaa79988623e55ba0e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 5 Apr 2016 16:19:50 +0200 Subject: -fsanitize=nonnull-attribute Change-Id: Ice9fef5bdfd3e993b1b2ba035cbc971b8dacbe3a --- xmlscript/source/xml_helper/xml_byteseq.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'xmlscript/source') diff --git a/xmlscript/source/xml_helper/xml_byteseq.cxx b/xmlscript/source/xml_helper/xml_byteseq.cxx index 56cc5d29df0c..19bdb0b8e180 100644 --- a/xmlscript/source/xml_helper/xml_byteseq.cxx +++ b/xmlscript/source/xml_helper/xml_byteseq.cxx @@ -69,7 +69,9 @@ sal_Int32 BSeqInputStream::readBytes( if (rData.getLength() != nBytesToRead) rData.realloc( nBytesToRead ); - memcpy(rData.getArray(), &_seq.data()[_nPos], nBytesToRead); + if (nBytesToRead != 0) { + memcpy(rData.getArray(), &_seq.data()[_nPos], nBytesToRead); + } _nPos += nBytesToRead; return nBytesToRead; } @@ -145,7 +147,9 @@ Reference< io::XInputStream > SAL_CALL createInputStream( std::vector Reference< io::XInputStream > SAL_CALL createInputStream( const sal_Int8* pData, int len ) { std::vector rInData(len); - memcpy( rInData.data(), pData, len); + if (len != 0) { + memcpy( rInData.data(), pData, len); + } return new BSeqInputStream( rInData ); } -- cgit