diff options
-rw-r--r-- | document/src/vespa/document/util/bytebuffer.cpp | 4 | ||||
-rw-r--r-- | vdslib/src/vespa/vdslib/container/searchresult.cpp | 4 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/data/memorydatastore.cpp | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/document/src/vespa/document/util/bytebuffer.cpp b/document/src/vespa/document/util/bytebuffer.cpp index 3d38aba6dae..8568ce44c5e 100644 --- a/document/src/vespa/document/util/bytebuffer.cpp +++ b/document/src/vespa/document/util/bytebuffer.cpp @@ -164,7 +164,9 @@ void ByteBuffer::getBytes(void *buffer, uint32_t count) { const char *v = getBufferAtPos(); incPos(count); - memcpy(buffer, v, count); + if (count > 0) { + memcpy(buffer, v, count); + } } } // document diff --git a/vdslib/src/vespa/vdslib/container/searchresult.cpp b/vdslib/src/vespa/vdslib/container/searchresult.cpp index 12d5544d6ef..6989fbca8e0 100644 --- a/vdslib/src/vespa/vdslib/container/searchresult.cpp +++ b/vdslib/src/vespa/vdslib/container/searchresult.cpp @@ -63,7 +63,9 @@ size_t BlobContainer::append(const void * v, size_t sz) if (getSize() > _blob.size()) { _blob.realloc(getSize()*2); } - memcpy(_blob.str() + _offsets[index], v, sz); + if (sz > 0) { + memcpy(_blob.str() + _offsets[index], v, sz); + } return index; } diff --git a/vespalib/src/vespa/vespalib/data/memorydatastore.cpp b/vespalib/src/vespa/vespalib/data/memorydatastore.cpp index 6951da217c7..f7fa627ea7e 100644 --- a/vespalib/src/vespa/vespalib/data/memorydatastore.cpp +++ b/vespalib/src/vespa/vespalib/data/memorydatastore.cpp @@ -35,7 +35,9 @@ MemoryDataStore::push_back(const void * data, const size_t sz) Reference ref(static_cast<char *>(buf.get()) + _writePos); _writePos += sz; guard.reset(); - memcpy(ref.data(), data, sz); + if (sz > 0) { + memcpy(ref.data(), data, sz); + } return ref; } |