aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-11-17 01:32:21 +0800
committerchriseth <c@ethdev.com>2015-11-17 01:32:21 +0800
commit0c900f9b8afe4094ca52030f55fcf5e84980cc12 (patch)
tree263bbba4f24ed18f304b7f2aae57396e665de3d8 /test/libsolidity/SolidityEndToEndTest.cpp
parentc881d103b26ff80ddfe6bfcea186bdca46a27d30 (diff)
downloaddexon-solidity-0c900f9b8afe4094ca52030f55fcf5e84980cc12.tar.gz
dexon-solidity-0c900f9b8afe4094ca52030f55fcf5e84980cc12.tar.zst
dexon-solidity-0c900f9b8afe4094ca52030f55fcf5e84980cc12.zip
Fix memory overwrite problem for arrays.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 460396a8..d39f87c9 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5781,6 +5781,21 @@ BOOST_AUTO_TEST_CASE(lone_struct_array_type)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(3)));
}
+BOOST_AUTO_TEST_CASE(memory_overwrite)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function f() returns (bytes x) {
+ x = "12345";
+ x[3] = 0x61;
+ x[0] = 0x62;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callContractFunction("f()") == encodeDyn(string("b23a5")));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}