It doesn’t seem ideal to have an integer sanitizer enabled, but then disable it for the whole validation.cpp file.
Fix it with a refactor and remove the suppression.
It doesn’t seem ideal to have an integer sanitizer enabled, but then disable it for the whole validation.cpp file.
Fix it with a refactor and remove the suppression.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
No conflicts as of last run.
int
is only guaranteed to have a max value of 32768. In a 2 MB block, that’s 61 bytes per input. Seems quite possible to hit it?
OTOH, I don’t think we support/work on such platforms right now, so this probably isn’t a real issue. So utACK anyway.
It wouldn’t be possible to start Bitcoin Core if int max was 32768. See also:
0src/compat/assumptions.h:static_assert(sizeof(short) == 2, "16-bit short assumed");
1src/compat/assumptions.h:static_assert(sizeof(int) == 4, "32-bit int assumed");
2src/compat/assumptions.h:static_assert(sizeof(unsigned) == 4, "32-bit unsigned assumed");
3src/compat/assumptions.h:static_assert(sizeof(size_t) == 4 || sizeof(size_t) == 8, "size_t assumed to be 32-bit or 64-bit");
1786@@ -1787,8 +1787,8 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI
1787 error("DisconnectBlock(): transaction and undo data inconsistent");
1788 return DISCONNECT_FAILED;
1789 }
1790- for (unsigned int j = tx.vin.size(); j-- > 0;) {
1791- const COutPoint &out = tx.vin[j].prevout;
1792+ for (int j = int(tx.vin.size()); j-- > 0;) {
nit: Is this equivalent to below? If so, is that more clear?
0 for (int j = int(tx.vin.size()) - 1; j >= 0; j--) {