diff options
author | chriseth <chris@ethereum.org> | 2016-11-01 01:35:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-01 01:35:02 +0800 |
commit | 1d3460c4e26d9ae2f91bb92276a975dfe45b62ea (patch) | |
tree | 5a9228a84df7723a13d27343afadd5f45b0010a0 /test | |
parent | e85390cc60cb8305b9cda9241d90017dd460dd73 (diff) | |
parent | 1427c82c77ecfb1bfba7490ad656dc2ed414873c (diff) | |
download | dexon-solidity-1d3460c4e26d9ae2f91bb92276a975dfe45b62ea.tar dexon-solidity-1d3460c4e26d9ae2f91bb92276a975dfe45b62ea.tar.gz dexon-solidity-1d3460c4e26d9ae2f91bb92276a975dfe45b62ea.tar.bz2 dexon-solidity-1d3460c4e26d9ae2f91bb92276a975dfe45b62ea.tar.lz dexon-solidity-1d3460c4e26d9ae2f91bb92276a975dfe45b62ea.tar.xz dexon-solidity-1d3460c4e26d9ae2f91bb92276a975dfe45b62ea.tar.zst dexon-solidity-1d3460c4e26d9ae2f91bb92276a975dfe45b62ea.zip |
Merge pull request #1307 from ethereum/fixclean
Fix cleanup of higher order bytes prior to store.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 8ef9a45b..8600443d 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -7533,6 +7533,26 @@ BOOST_AUTO_TEST_CASE(inline_assembly_in_modifiers) BOOST_CHECK(callContractFunction("f()") == encodeArgs(true)); } +BOOST_AUTO_TEST_CASE(packed_storage_overflow) +{ + char const* sourceCode = R"( + contract C { + uint16 x = 0x1234; + uint16 a = 0xffff; + uint16 b; + function f() returns (uint, uint, uint, uint) { + a++; + uint c = b; + delete b; + a -= 2; + return (x, c, b, a); + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(0x1234), u256(0), u256(0), u256(0xfffe))); +} + BOOST_AUTO_TEST_SUITE_END() } |