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.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
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:
src/compat/assumptions.h:static_assert(sizeof(short) == 2, "16-bit short assumed");
src/compat/assumptions.h:static_assert(sizeof(int) == 4, "32-bit int assumed");
src/compat/assumptions.h:static_assert(sizeof(unsigned) == 4, "32-bit unsigned assumed");
src/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?
for (int j = int(tx.vin.size()) - 1; j >= 0; j--) {
pushed something else
utACK fa2d0c7008864384012c1bd84a602b85231f5983 modulo nit
Changed to a pure refactor, that doesn't change any types. Also, it doesn't change the binary with clang++ -O2 on my system, though with gcc it does. It is the same refactor that was used in #https://github.com/bitcoin/bitcoin/pull/24227
ACK fac62056b56e0a28baf0b6f285752d83fbf96074, I have reviewed the code and it looks OK, I agree it can be merged.