mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Test for incorrect storage access.
This commit is contained in:
parent
d2f18c73f7
commit
a88835bbce
@ -369,6 +369,27 @@ BOOST_AUTO_TEST_CASE(successor_not_found_bug)
|
|||||||
compileBothVersions(sourceCode);
|
compileBothVersions(sourceCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(incorrect_storage_access_bug)
|
||||||
|
{
|
||||||
|
// This bug appeared because a sha3 operation with too low sequence number was used,
|
||||||
|
// resulting in memory not being rewritten before the sha3. The fix was to
|
||||||
|
// take the max of the min sequence numbers when merging the states.
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract C
|
||||||
|
{
|
||||||
|
mapping(uint => uint) data;
|
||||||
|
function f() returns (uint)
|
||||||
|
{
|
||||||
|
if(data[now] == 0)
|
||||||
|
data[uint(-7)] = 5;
|
||||||
|
return data[now];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileBothVersions(sourceCode);
|
||||||
|
compareVersions("f()");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(cse_intermediate_swap)
|
BOOST_AUTO_TEST_CASE(cse_intermediate_swap)
|
||||||
{
|
{
|
||||||
eth::KnownState state;
|
eth::KnownState state;
|
||||||
|
Loading…
Reference in New Issue
Block a user