aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-10-01 20:53:45 +0800
committerchriseth <c@ethdev.com>2015-10-01 22:50:11 +0800
commit6161ec96ff4a449d6fffa3d1e54c3fa38911c2bb (patch)
tree4860eb391362a98e8346ae5b80850970dfedbd59 /test/libsolidity/SolidityEndToEndTest.cpp
parent5f6c3cdf5414af457569041d1fdf6caa4cf9a82c (diff)
downloaddexon-solidity-6161ec96ff4a449d6fffa3d1e54c3fa38911c2bb.tar.gz
dexon-solidity-6161ec96ff4a449d6fffa3d1e54c3fa38911c2bb.tar.zst
dexon-solidity-6161ec96ff4a449d6fffa3d1e54c3fa38911c2bb.zip
Bugfix in calldata unpacker.
The offset was not specified correctly if memory activity preceded the unpacker.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 3124f9cf..0459c3ae 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5354,6 +5354,25 @@ BOOST_AUTO_TEST_CASE(fixed_arrays_as_return_type)
);
}
+BOOST_AUTO_TEST_CASE(calldata_offset)
+{
+ // This tests a specific bug that was caused by not using the correct memory offset in the
+ // calldata unpacker.
+ char const* sourceCode = R"(
+ contract CB
+ {
+ address[] _arr;
+ string public last = "nd";
+ function CB(address[] guardians)
+ {
+ _arr = guardians;
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "CB", encodeArgs(u256(0x20)));
+ BOOST_CHECK(callContractFunction("last()", encodeArgs()) == encodeDyn(string("nd")));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}