Skip to content

Commit fa99e10

Browse files
author
MarcoFalke
committed
Fix implicit-integer-sign-change in arith_uint256
1 parent 290ff5e commit fa99e10

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/arith_uint256.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ base_uint<BITS>& base_uint<BITS>::operator/=(const base_uint& b)
9696
while (shift >= 0) {
9797
if (num >= div) {
9898
num -= div;
99-
pn[shift / 32] |= (1 << (shift & 31)); // set a bit of the result.
99+
pn[shift / 32] |= (1U << (shift & 31)); // set a bit of the result.
100100
}
101101
div >>= 1; // shift back.
102102
shift--;
@@ -236,7 +236,7 @@ uint32_t arith_uint256::GetCompact(bool fNegative) const
236236
nCompact >>= 8;
237237
nSize++;
238238
}
239-
assert((nCompact & ~0x007fffff) == 0);
239+
assert((nCompact & ~0x007fffffU) == 0);
240240
assert(nSize < 256);
241241
nCompact |= nSize << 24;
242242
nCompact |= (fNegative && (nCompact & 0x007fffff) ? 0x00800000 : 0);

test/sanitizer_suppressions/ubsan

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ unsigned-integer-overflow:txmempool.cpp
6262
unsigned-integer-overflow:util/strencodings.cpp
6363
unsigned-integer-overflow:validation.cpp
6464
implicit-integer-sign-change:addrman.h
65-
implicit-integer-sign-change:arith_uint256.cpp
6665
implicit-integer-sign-change:bech32.cpp
6766
implicit-integer-sign-change:common/bloom.cpp
6867
implicit-integer-sign-change:chain.cpp

0 commit comments

Comments
 (0)