diff options
author | chriseth <chris@ethereum.org> | 2018-10-30 22:31:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-30 22:31:47 +0800 |
commit | 437467acfcbd5a13cc3e30dd863bf3a3d35ce1c1 (patch) | |
tree | 8dbec3f3b37f938c912b38b6d21a22f620f554d3 /test | |
parent | 0b4f6ab72d36e68ce9bf5a10da0d785059d8709c (diff) | |
parent | 1d8e9af407fc8c47cae6401fb71463771d397d30 (diff) | |
download | dexon-solidity-437467acfcbd5a13cc3e30dd863bf3a3d35ce1c1.tar dexon-solidity-437467acfcbd5a13cc3e30dd863bf3a3d35ce1c1.tar.gz dexon-solidity-437467acfcbd5a13cc3e30dd863bf3a3d35ce1c1.tar.bz2 dexon-solidity-437467acfcbd5a13cc3e30dd863bf3a3d35ce1c1.tar.lz dexon-solidity-437467acfcbd5a13cc3e30dd863bf3a3d35ce1c1.tar.xz dexon-solidity-437467acfcbd5a13cc3e30dd863bf3a3d35ce1c1.tar.zst dexon-solidity-437467acfcbd5a13cc3e30dd863bf3a3d35ce1c1.zip |
Merge pull request #5188 from ethereum/large-array-encoding
Do not crash when trying to encode too large arrays
Diffstat (limited to 'test')
3 files changed, 26 insertions, 0 deletions
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. |