aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-11-15 04:38:02 +0800
committerGitHub <noreply@github.com>2016-11-15 04:38:02 +0800
commit3f74c3c2369e59cb480cafdb31eeab6c18011504 (patch)
tree65bcb9042231370df0f4049bc8d5e8b65c6fdeb8
parent7884a6924380495969a8e7da4e5ae579020434f0 (diff)
parente6247195ddc38b437b8b22b4f5fcd80f25a960a7 (diff)
downloaddexon-solidity-3f74c3c2369e59cb480cafdb31eeab6c18011504.tar
dexon-solidity-3f74c3c2369e59cb480cafdb31eeab6c18011504.tar.gz
dexon-solidity-3f74c3c2369e59cb480cafdb31eeab6c18011504.tar.bz2
dexon-solidity-3f74c3c2369e59cb480cafdb31eeab6c18011504.tar.lz
dexon-solidity-3f74c3c2369e59cb480cafdb31eeab6c18011504.tar.xz
dexon-solidity-3f74c3c2369e59cb480cafdb31eeab6c18011504.tar.zst
dexon-solidity-3f74c3c2369e59cb480cafdb31eeab6c18011504.zip
Merge pull request #1371 from ethereum/invalid_enum_as_external_arg
Throw exception on invalid enum value as external call argument
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 74cf53cf..739a2efd 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -4533,6 +4533,33 @@ BOOST_AUTO_TEST_CASE(invalid_enum_as_external_ret)
BOOST_CHECK(callContractFunction("test_assignment()") == encodeArgs());
}
+BOOST_AUTO_TEST_CASE(invalid_enum_as_external_arg)
+{
+ char const* sourceCode = R"(
+ contract C {
+ enum X { A, B }
+
+ function tested (X x) returns (uint) {
+ return 1;
+ }
+
+ function test() returns (uint) {
+ X garbled;
+
+ assembly {
+ garbled := 5
+ }
+
+ return this.tested(garbled);
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ // should throw
+ BOOST_CHECK(callContractFunction("test()") == encodeArgs());
+}
+
+
BOOST_AUTO_TEST_CASE(proper_order_of_overwriting_of_attributes)
{
// bug #1798