Open chenxu2048 opened 4 years ago
It seems that there are similar problems in:
dev::p2p::Host::saveNetwork() const
dev::p2p::PingNode::streamRLP(dev::RLPStream&) const
dev::p2p::Pong::streamRLP(dev::RLPStream&) const
void dev::rlpListAux
dev::eth::TransactionBase::streamRLP(dev::RLPStream&, dev::eth::IncludeSignature, bool) const
BugLevel: Tiny
Result: No impact in the near future Summary: int64_t to unsigned casting while converting to RLP format.
BlockHeader::streamRLP
usingstd::ostream& operator<<(std::ostream& _out, dev::RLP const& _d)
to convert block header to RLP. In /libdevcore/RLP.h, it callsRLP::append
in functionoperator <<
. AndRLP::append
hasunsigned
,u160
,u256
andbigint
overloading. However,BlockHeader::m_timestamp
andBlockHeader::m_number
isint64_t
which will matchRLP::append<unsigned>
and maybe cause a casting overflow sinceunsigned
could be 32 bits in some platform.This overflow could happen after about 150 years 😂.
The testing code could be:
Or a RLP test case:
Platform: Ubuntu 18.04 Compiler: GCC 7.5.0