diff options
author | Tor Egge <Tor.Egge@online.no> | 2022-12-09 10:46:55 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2022-12-09 10:46:55 +0100 |
commit | 70fdb815d692531d78e94d78e26938de2065c30b (patch) | |
tree | 19c2a82142a8dfaf58599527e961dc119c6600a0 /vespalib | |
parent | 0f15b405cad738460a8126bf9ef689ec3edfd094 (diff) |
Avoid nullptr memcpy argument.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.cpp b/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.cpp index 9c639067615..3e2adf21619 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.cpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.cpp @@ -53,7 +53,9 @@ UniqueStoreSmallStringBufferType::fallbackCopy(void *newBuffer, const void *oldB { static_assert(std::is_trivially_copyable<UniqueStoreSmallStringEntry>::value, "UniqueStoreSmallStringEntry must be trivially copyable"); - memcpy(newBuffer, oldBuffer, numElems); + if (numElems > 0) { + memcpy(newBuffer, oldBuffer, numElems); + } } void |