aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLeonardo Alt <leo@ethereum.org>2018-06-04 18:31:18 +0800
committerLeonardo Alt <leo@ethereum.org>2018-06-26 16:27:48 +0800
commit7763d21cc6181204b1454437b051ac56d3e89339 (patch)
tree3e91f603daf0091688e32f915d88281783986fa1 /test
parent4be9dc430452ca73ffb07f987f27fb6ccf4ac848 (diff)
downloaddexon-solidity-7763d21cc6181204b1454437b051ac56d3e89339.tar
dexon-solidity-7763d21cc6181204b1454437b051ac56d3e89339.tar.gz
dexon-solidity-7763d21cc6181204b1454437b051ac56d3e89339.tar.bz2
dexon-solidity-7763d21cc6181204b1454437b051ac56d3e89339.tar.lz
dexon-solidity-7763d21cc6181204b1454437b051ac56d3e89339.tar.xz
dexon-solidity-7763d21cc6181204b1454437b051ac56d3e89339.tar.zst
dexon-solidity-7763d21cc6181204b1454437b051ac56d3e89339.zip
Revert if calldata is too short or points out of bounds
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/ABIDecoderTests.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/test/libsolidity/ABIDecoderTests.cpp b/test/libsolidity/ABIDecoderTests.cpp
index b588ca1b..17cb2223 100644
--- a/test/libsolidity/ABIDecoderTests.cpp
+++ b/test/libsolidity/ABIDecoderTests.cpp
@@ -266,7 +266,6 @@ BOOST_AUTO_TEST_CASE(calldata_arrays_too_large)
}
}
)";
- bool newEncoder = false;
BOTH_ENCODERS(
compileAndRun(sourceCode);
bytes args = encodeArgs(
@@ -275,9 +274,8 @@ BOOST_AUTO_TEST_CASE(calldata_arrays_too_large)
);
ABI_CHECK(
callContractFunction("f(uint256,uint256[],uint256)", args),
- newEncoder ? encodeArgs() : encodeArgs(7)
+ encodeArgs()
);
- newEncoder = true;
)
}
@@ -449,13 +447,11 @@ BOOST_AUTO_TEST_CASE(short_input_value_type)
function f(uint a, uint b) public pure returns (uint) { return a; }
}
)";
- bool newDecoder = false;
BOTH_ENCODERS(
compileAndRun(sourceCode);
ABI_CHECK(callContractFunction("f(uint256,uint256)", 1, 2), encodeArgs(1));
ABI_CHECK(callContractFunctionNoEncoding("f(uint256,uint256)", bytes(64, 0)), encodeArgs(0));
- ABI_CHECK(callContractFunctionNoEncoding("f(uint256,uint256)", bytes(63, 0)), newDecoder ? encodeArgs() : encodeArgs(0));
- newDecoder = true;
+ ABI_CHECK(callContractFunctionNoEncoding("f(uint256,uint256)", bytes(63, 0)), encodeArgs());
)
}
@@ -466,15 +462,13 @@ BOOST_AUTO_TEST_CASE(short_input_array)
function f(uint[] a) public pure returns (uint) { return 7; }
}
)";
- bool newDecoder = false;
BOTH_ENCODERS(
compileAndRun(sourceCode);
ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 0)), encodeArgs(7));
- ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1)), newDecoder ? encodeArgs() : encodeArgs(7));
- ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1) + bytes(31, 0)), newDecoder ? encodeArgs() : encodeArgs(7));
+ ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1)), encodeArgs());
+ ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1) + bytes(31, 0)), encodeArgs());
ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1) + bytes(32, 0)), encodeArgs(7));
ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 2, 5, 6)), encodeArgs(7));
- newDecoder = true;
)
}