diff options
-rw-r--r-- | Changelog.md | 1 | ||||
-rw-r--r-- | docs/contributing.rst | 2 | ||||
-rw-r--r-- | libsolidity/ast/Types.cpp | 3 | ||||
-rw-r--r-- | test/libsolidity/syntaxTests/array/length/parameter_too_large.sol | 5 | ||||
-rw-r--r-- | test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol | 11 | ||||
-rw-r--r-- | test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol | 10 |
6 files changed, 31 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md index 5bf194e4..ff95a89a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -128,6 +128,7 @@ Bugfixes: * Type Checker: Fix freeze for negative fixed-point literals very close to ``0``, such as ``-1e-100``. * Type Checker: Dynamic types as key for public mappings return error instead of assertion fail. * Type Checker: Fix internal error when array index value is too large. + * Type Checker: Fix internal error when fixed-size array is too large to be encoded. * Type Checker: Fix internal error for array type conversions. * Type Checker: Fix internal error when array index is not an unsigned. * Type System: Allow arbitrary exponents for literals with a mantissa of zero. diff --git a/docs/contributing.rst b/docs/contributing.rst index edd7361e..e626e5c0 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -16,7 +16,7 @@ In particular, we need help in the following areas: <https://gitter.im/ethereum/solidity>`_ * Fixing and responding to `Solidity's GitHub issues <https://github.com/ethereum/solidity/issues>`_, especially those tagged as - `up-for-grabs <https://github.com/ethereum/solidity/issues?q=is%3Aopen+is%3Aissue+label%3Aup-for-grabs>`_ which are + `good first issue <https://github.com/ethereum/solidity/labels/good%20first%20issue>`_ which are meant as introductory issues for external contributors. Please note that this project is released with a `Contributor Code of Conduct <https://raw.githubusercontent.com/ethereum/solidity/develop/CODE_OF_CONDUCT.md>`_. By participating in this project - in the issues, pull requests, or Gitter channels - you agree to abide by its terms. diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 301687b4..d5d11478 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1698,6 +1698,9 @@ bool ArrayType::operator==(Type const& _other) const bool ArrayType::validForCalldata() const { + if (auto arrayBaseType = dynamic_cast<ArrayType const*>(baseType().get())) + if (!arrayBaseType->validForCalldata()) + return false; return unlimitedCalldataEncodedSize(true) <= numeric_limits<unsigned>::max(); } diff --git a/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol b/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol new file mode 100644 index 00000000..02e0a7cc --- /dev/null +++ b/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol @@ -0,0 +1,5 @@ +contract C { + function f(bytes32[1263941234127518272] memory) public pure {} +} +// ---- +// TypeError: (26-61): Array is too large to be encoded. diff --git a/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol new file mode 100644 index 00000000..5f96ecd5 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol @@ -0,0 +1,11 @@ +contract C { + function f(bytes32[1263941234127518272][500] memory) public pure {} + function f(uint[2**30][] memory) public pure {} + function f(uint[2**30][2**30][] memory) public pure {} + function f(uint[2**16][2**16][] memory) public pure {} +} +// ---- +// TypeError: (26-66): Array is too large to be encoded. +// TypeError: (96-116): Array is too large to be encoded. +// TypeError: (146-173): Array is too large to be encoded. +// TypeError: (203-230): Array is too large to be encoded. diff --git a/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol new file mode 100644 index 00000000..de1fde3f --- /dev/null +++ b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol @@ -0,0 +1,10 @@ +pragma experimental ABIEncoderV2; + +contract C { + function f(bytes32[1263941234127518272][500] memory) public pure {} + function f(uint[2**30][2**30][][] memory) public pure {} +} +// ---- +// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments. +// TypeError: (61-101): Array is too large to be encoded. +// TypeError: (131-160): Array is too large to be encoded. |