diff --git a/src/shared_string.cc b/src/shared_string.cc index d76e0ac3..752ac828 100644 --- a/src/shared_string.cc +++ b/src/shared_string.cc @@ -16,6 +16,8 @@ StringDataPtr StringData::create(ArrayView strs) auto* data = reinterpret_cast(res + 1); for (auto& str : strs) { + if (str.length() == 0) // memccpy(..., nullptr, 0) is UB + continue; memcpy(data, str.begin(), (size_t)str.length()); data += (int)str.length(); }