Fix integer sanitizer suppressions in validation.cpp#24196
Fix integer sanitizer suppressions in validation.cpp#24196maflcko merged 1 commit intobitcoin:masterfrom
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
luke-jr
left a comment
There was a problem hiding this comment.
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: |
PastaPastaPasta
left a comment
There was a problem hiding this comment.
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 ##24227 |
Summary: While looking at backporting [[bitcoin/bitcoin#24196 | core#24196]], I noticed that the offending code was already changed in D359 (`unsigned int` -> `size_t`) and fixed in D1528 (removal of the `for (size_t j = tx.vin.size(); j-- > 0;)` loop) Removing the file-wide suppression means that new UB can now be detected. Test Plan: With UBSAN `ninja && ninja check check-functional` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D12821
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.