Skip to content

Commit

Permalink
Fix integer overflow due to large unsigned cpp_int
Browse files Browse the repository at this point in the history
  • Loading branch information
bshastry committed Dec 15, 2020
1 parent d83ce0b commit 39f1893
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/tools/ossfuzz/protoToAbiV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 39f1893

Please sign in to comment.