Skip to content

Commit

Permalink
pr comment
Browse files Browse the repository at this point in the history
Signed-off-by: turuslan <[email protected]>
  • Loading branch information
turuslan committed Jan 12, 2024
1 parent c3107b7 commit ae8bc23
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/protocol_muxer/multiselect/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ namespace libp2p::protocol_muxer::multiselect::detail {

if (expected_msg_size_ == 0) {
auto s = varint_reader_.consume(data);
if (varint_reader_.size() > kMaxLenBytes) {
state_ = kOverflow;
break;
}
if (s == VarintPrefixReader::kUnderflow) {
if (varint_reader_.size() >= kMaxLenBytes) {
if (varint_reader_.size() == kMaxLenBytes) {
state_ = kOverflow;
break;
}
Expand All @@ -55,10 +59,6 @@ namespace libp2p::protocol_muxer::multiselect::detail {
state_ = kOverflow;
break;
}
if (varint_reader_.size() > kMaxLenBytes) {
state_ = kOverflow;
break;
}
expected_msg_size_ = static_cast<IndexType>(varint_reader_.value());
if (expected_msg_size_ == 0) {
// zero varint received, not acceptable, but not fatal
Expand Down

0 comments on commit ae8bc23

Please sign in to comment.