aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <alexvru@ydb.tech>2023-11-13 13:07:33 +0300
committeralexvru <alexvru@ydb.tech>2023-11-13 14:14:29 +0300
commit4b0ab240514a8f5e46ec0b3e372cdb0f9637dd09 (patch)
treeca2cfe2f5d8398c96b116999b13a4fa25fb7aecb
parentb598927a0221c88565b4d51982e3364e2b47ed66 (diff)
downloadydb-4b0ab240514a8f5e46ec0b3e372cdb0f9637dd09.tar.gz
Fix ubsan false-positive
-rw-r--r--library/cpp/actors/interconnect/outgoing_stream.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/cpp/actors/interconnect/outgoing_stream.h b/library/cpp/actors/interconnect/outgoing_stream.h
index 980bd401f0..304fa925a8 100644
--- a/library/cpp/actors/interconnect/outgoing_stream.h
+++ b/library/cpp/actors/interconnect/outgoing_stream.h
@@ -67,7 +67,10 @@ namespace NInterconnect {
}
TMutableContiguousSpan AcquireSpanForWriting(size_t maxLen) {
- if (maxLen && AppendOffset == BufferSize) { // we have no free buffer, allocate one
+ if (!maxLen) {
+ return {nullptr, 0};
+ }
+ if (AppendOffset == BufferSize) { // we have no free buffer, allocate one
Buffers.emplace_back(static_cast<TBuffer*>(malloc(sizeof(TBuffer))));
AppendBuffer = Buffers.back().get();
Y_ABORT_UNLESS(AppendBuffer);