fix UB in fuzzer common (memcpy on nullptr)

This commit is contained in:
Paul Dreik 2021-08-21 14:24:30 +02:00 committed by Victor Zverovich
parent e77686f7a8
commit 7af1dc1d27

View File

@ -56,8 +56,10 @@ struct data_to_string {
data_to_string(const uint8_t* data, size_t size, bool add_terminator = false)
: buffer(size + (add_terminator ? 1 : 0)) {
if (size) {
std::memcpy(buffer.data(), data, size);
}
}
fmt::string_view get() const { return {buffer.data(), buffer.size()}; }
#else