diff options
author | alexvru <alexvru@ydb.tech> | 2023-01-25 13:53:52 +0300 |
---|---|---|
committer | alexvru <alexvru@ydb.tech> | 2023-01-25 13:53:52 +0300 |
commit | 0e6d560a6e62b07cec2309e8aa926e733aae21c7 (patch) | |
tree | 21216f77955deac1451f35ed4dd9de65c3e1d839 /library/cpp | |
parent | eb8f3a102f1e0d4bd1aaf4cca5a74a68455d8ab7 (diff) | |
download | ydb-0e6d560a6e62b07cec2309e8aa926e733aae21c7.tar.gz |
Fix ubsan errors in VDisk
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/actors/util/rc_buf.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/library/cpp/actors/util/rc_buf.h b/library/cpp/actors/util/rc_buf.h index 23d9ad4881e..8a6b8cd6071 100644 --- a/library/cpp/actors/util/rc_buf.h +++ b/library/cpp/actors/util/rc_buf.h @@ -121,10 +121,11 @@ public: private: static int Compare(const TContiguousSpan& x, const TContiguousSpan& y) { - if (int res = std::memcmp(x.data(), y.data(), std::min(x.size(), y.size())); res) { - return res; + int res = 0; + if (const size_t common = std::min(x.size(), y.size())) { + res = std::memcmp(x.data(), y.data(), common); } - return x.size() - y.size(); + return res ? res : x.size() - y.size(); } }; |