mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix integer overflow due to large unsigned cpp_int
This commit is contained in:
parent
d83ce0bcdd
commit
39f1893956
@ -69,7 +69,7 @@ static V integerValue(unsigned _counter)
|
||||
V value = V(
|
||||
u256(solidity::util::keccak256(solidity::util::h256(_counter))) % u256(boost::math::tools::max_value<V>())
|
||||
);
|
||||
if (value % 2 == 0)
|
||||
if (boost::multiprecision::is_signed_number<V>::value && value % 2 == 0)
|
||||
return value * (-1);
|
||||
else
|
||||
return value;
|
||||
|
Loading…
Reference in New Issue
Block a user