mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix wrong assert in overflow check
This commit is contained in:
parent
e56d1aa5aa
commit
c3e8023ad5
@ -9,6 +9,7 @@ Compiler Features:
|
||||
|
||||
Bugfixes:
|
||||
* Type Checker: Disallow constructor of the same class to be used as modifier
|
||||
* Code Generator: Fixed a faulty assert that would wrongly trigger for array sizes exceeding unsigned integer
|
||||
|
||||
|
||||
|
||||
|
@ -1849,7 +1849,7 @@ u256 ArrayType::memoryDataSize() const
|
||||
solAssert(m_location == DataLocation::Memory, "");
|
||||
solAssert(!isByteArray(), "");
|
||||
bigint size = bigint(m_length) * m_baseType->memoryHeadSize();
|
||||
solAssert(size <= numeric_limits<unsigned>::max(), "Array size does not fit u256.");
|
||||
solAssert(size <= numeric_limits<u256>::max(), "Array size does not fit u256.");
|
||||
return u256(size);
|
||||
}
|
||||
|
||||
|
10
test/libsolidity/syntaxTests/array/length/not_too_large.sol
Normal file
10
test/libsolidity/syntaxTests/array/length/not_too_large.sol
Normal file
@ -0,0 +1,10 @@
|
||||
// Used to cause ICE because of a too strict assert
|
||||
pragma experimental ABIEncoderV2;
|
||||
contract C {
|
||||
struct S { uint a; T[222222222222222222222222222] sub; }
|
||||
struct T { uint[] x; }
|
||||
function f() public returns (uint, S memory) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (52-85): Experimental features are turned on. Do not use experimental features on live deployments.
|
Loading…
Reference in New Issue
Block a user