Skip to content

Commit 407175e

Browse files
committed
p2p: change CInv::type from int to uint32_t
fixes issue #19678 UBSan implicit-integer-sign-change Credit to Eugene (Crypt-iQ) for finding and reporting the issue and to Vasil Dimov (vasild) for the original suggestion
1 parent 2562d5d commit 407175e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/protocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ CInv::CInv()
163163
hash.SetNull();
164164
}
165165

166-
CInv::CInv(int typeIn, const uint256& hashIn) : type(typeIn), hash(hashIn) {}
166+
CInv::CInv(uint32_t typeIn, const uint256& hashIn) : type(typeIn), hash(hashIn) {}
167167

168168
bool operator<(const CInv& a, const CInv& b)
169169
{

src/protocol.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ class CInv
408408
{
409409
public:
410410
CInv();
411-
CInv(int typeIn, const uint256& hashIn);
411+
CInv(uint32_t typeIn, const uint256& hashIn);
412412

413413
SERIALIZE_METHODS(CInv, obj) { READWRITE(obj.type, obj.hash); }
414414

@@ -425,7 +425,7 @@ class CInv
425425
// Combined-message helper methods
426426
bool IsGenTxMsg() const { return type == MSG_TX || type == MSG_WTX || type == MSG_WITNESS_TX; }
427427

428-
int type;
428+
uint32_t type;
429429
uint256 hash;
430430
};
431431

0 commit comments

Comments
 (0)