From 27aaa1152407f8b119f383e5e57fe7847354adae Mon Sep 17 00:00:00 2001 From: ton Date: Sat, 29 Feb 2020 09:07:12 +0400 Subject: [PATCH] fixed crash in adnl --- adnl/adnl-peer.cpp | 4 ++-- adnl/adnl-peer.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adnl/adnl-peer.cpp b/adnl/adnl-peer.cpp index e5f6463e..b0a6b650 100644 --- a/adnl/adnl-peer.cpp +++ b/adnl/adnl-peer.cpp @@ -147,7 +147,7 @@ void AdnlPeerPairImpl::receive_packet_checked(AdnlPacket packet) { return; } if (packet.seqno() > 0) { - if (received_packet(static_cast(packet.seqno()))) { + if (received_packet(packet.seqno())) { VLOG(ADNL_INFO) << this << ": dropping IN message: old seqno: " << packet.seqno() << " (current max " << in_seqno_ << ")"; return; @@ -165,7 +165,7 @@ void AdnlPeerPairImpl::receive_packet_checked(AdnlPacket packet) { // delivering if (packet.seqno() > 0) { - add_received_packet(static_cast(packet.seqno())); + add_received_packet(packet.seqno()); } if (packet.confirm_seqno() > ack_seqno_) { diff --git a/adnl/adnl-peer.hpp b/adnl/adnl-peer.hpp index 171be5ea..552ccb37 100644 --- a/adnl/adnl-peer.hpp +++ b/adnl/adnl-peer.hpp @@ -123,7 +123,7 @@ class AdnlPeerPairImpl : public AdnlPeerPair { td::Result> get_conn(); void create_channel(pubkeys::Ed25519 pub, td::uint32 date); - bool received_packet(td::uint32 seqno) const { + bool received_packet(td::uint64 seqno) const { CHECK(seqno > 0); if (seqno + 64 <= in_seqno_) { return true; @@ -134,7 +134,7 @@ class AdnlPeerPairImpl : public AdnlPeerPair { return recv_seqno_mask_ & (1ull << (in_seqno_ - seqno)); } - void add_received_packet(td::uint32 seqno) { + void add_received_packet(td::uint64 seqno) { CHECK(!received_packet(seqno)); if (seqno <= in_seqno_) { recv_seqno_mask_ |= (1ull << (in_seqno_ - seqno));