mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 19:53:27 +01:00
Avoid unintentional unsigned integer wraparounds in tests
This commit is contained in:
@@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt)
|
||||
test.erase(InsecureRandRange(test.size()));
|
||||
}
|
||||
if (InsecureRandBits(3) == 2) {
|
||||
int new_size = std::max<int>(0, std::min<int>(30, test.size() + (InsecureRandRange(5)) - 2));
|
||||
int new_size = std::max(0, std::min(30, (int)test.size() + (int)InsecureRandRange(5) - 2));
|
||||
test.resize(new_size);
|
||||
}
|
||||
if (InsecureRandBits(3) == 3) {
|
||||
|
||||
Reference in New Issue
Block a user