diff options
author | snaury <snaury@ydb.tech> | 2023-02-16 12:05:49 +0300 |
---|---|---|
committer | snaury <snaury@ydb.tech> | 2023-02-16 12:05:49 +0300 |
commit | 463633625b0cd4f6dac71bb122e40d0c2bd856d7 (patch) | |
tree | 9d87b54300eb0fbd6f935dd9dabca27be77fbe7b | |
parent | 2833f666f68066051c16ce5769ed730127293cdc (diff) | |
download | ydb-463633625b0cd4f6dac71bb122e40d0c2bd856d7.tar.gz |
Fix protobuf ubsan error when parsing empty arrays
-rw-r--r-- | contrib/libs/protobuf/src/google/protobuf/parse_context.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/libs/protobuf/src/google/protobuf/parse_context.h b/contrib/libs/protobuf/src/google/protobuf/parse_context.h index 8d726894c9..32c72f9c64 100644 --- a/contrib/libs/protobuf/src/google/protobuf/parse_context.h +++ b/contrib/libs/protobuf/src/google/protobuf/parse_context.h @@ -234,7 +234,9 @@ class PROTOBUF_EXPORT EpsCopyInputStream { if (aliasing_ == kOnPatch) aliasing_ = kNoDelta; return flat.data(); } else { - std::memcpy(buffer_, flat.data(), flat.size()); + if (!flat.empty()) { + std::memcpy(buffer_, flat.data(), flat.size()); + } limit_ = 0; limit_end_ = buffer_end_ = buffer_ + flat.size(); next_chunk_ = nullptr; |