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

Stephan Bergmann sbergman at redhat.com
Tue Apr 5 14:20:16 UTC 2016


 xmlscript/source/xml_helper/xml_byteseq.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 5b32ba4217e88f3f6fab0baaa79988623e55ba0e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Apr 5 16:19:50 2016 +0200

    -fsanitize=nonnull-attribute
    
    Change-Id: Ice9fef5bdfd3e993b1b2ba035cbc971b8dacbe3a

diff --git a/xmlscript/source/xml_helper/xml_byteseq.cxx b/xmlscript/source/xml_helper/xml_byteseq.cxx
index 56cc5d2..19bdb0b 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<sal_Int8>
 Reference< io::XInputStream > SAL_CALL createInputStream( const sal_Int8* pData, int len )
 {
     std::vector<sal_Int8> rInData(len);
-    memcpy( rInData.data(), pData, len);
+    if (len != 0) {
+        memcpy( rInData.data(), pData, len);
+    }
     return new BSeqInputStream( rInData );
 }
 


More information about the Libreoffice-commits mailing list