Skip to content

Commit

Permalink
Checking received data size and reject if not match.
Browse files Browse the repository at this point in the history
We dont need to panic in this case, fetchData can handle this.

Signed-off-by: Xiaoxi Chen <xiaoxchen@ebay.com>
  • Loading branch information
xiaoxichen committed Nov 14, 2024
1 parent 328cef3 commit 88d80c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "6.5.11"
version = "6.5.12"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
8 changes: 6 additions & 2 deletions src/lib/replication/repl_dev/raft_repl_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,12 @@ void RaftReplDev::on_push_data_received(intrusive< sisl::GenericRpcData >& rpc_d
auto const fb_size =
flatbuffers::ReadScalar< flatbuffers::uoffset_t >(incoming_buf.cbytes()) + sizeof(flatbuffers::uoffset_t);
auto push_req = GetSizePrefixedPushDataRequest(incoming_buf.cbytes());
HS_DBG_ASSERT_EQ(fb_size + push_req->data_size(), incoming_buf.size(), "Size mismatch of data size vs buffer size");

if (fb_size + push_req->data_size() != incoming_buf.size()) {
RD_LOGW("Data Channel: PushData received with size mismatch, header size {}, data size {}, received size {}",
fb_size, push_req->data_size(), incoming_buf.size());
rpc_data->send_response();
return;
}
sisl::blob header = sisl::blob{push_req->user_header()->Data(), push_req->user_header()->size()};
sisl::blob key = sisl::blob{push_req->user_key()->Data(), push_req->user_key()->size()};
repl_key rkey{.server_id = push_req->issuer_replica_id(), .term = push_req->raft_term(), .dsn = push_req->dsn()};
Expand Down

0 comments on commit 88d80c8

Please sign in to comment.