diff options
author | chriseth <c@ethdev.com> | 2016-01-15 23:26:12 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-01-15 23:34:56 +0800 |
commit | 1b1b6651cd60fcaded8043dc00e61df075fe2e4a (patch) | |
tree | 505d2d3d342ef49e449317ca92324614a8d6a9b5 /KnownState.cpp | |
parent | 6e98243ead4843a4dd28fcae312f3b8af6cc7b03 (diff) | |
download | dexon-solidity-1b1b6651cd60fcaded8043dc00e61df075fe2e4a.tar.gz dexon-solidity-1b1b6651cd60fcaded8043dc00e61df075fe2e4a.tar.zst dexon-solidity-1b1b6651cd60fcaded8043dc00e61df075fe2e4a.zip |
Fix sequence number bug.
This bug resulted in incorrect storage access in some situations.
The reason was that when intersecting states, the sequence numbers
were not handled and thus some operations with too low
sequence numbers were used during code generation.
Diffstat (limited to 'KnownState.cpp')
-rw-r--r-- | KnownState.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/KnownState.cpp b/KnownState.cpp index 55e860e2..39cce3e8 100644 --- a/KnownState.cpp +++ b/KnownState.cpp @@ -175,7 +175,7 @@ template <class _Mapping> void intersect(_Mapping& _this, _Mapping const& _other it = _this.erase(it); } -void KnownState::reduceToCommonKnowledge(KnownState const& _other) +void KnownState::reduceToCommonKnowledge(KnownState const& _other, bool _combineSequenceNumbers) { int stackDiff = m_stackHeight - _other.m_stackHeight; for (auto it = m_stackElements.begin(); it != m_stackElements.end();) @@ -213,9 +213,11 @@ void KnownState::reduceToCommonKnowledge(KnownState const& _other) intersect(m_storageContent, _other.m_storageContent); intersect(m_memoryContent, _other.m_memoryContent); + if (_combineSequenceNumbers) + m_sequenceNumber = max(m_sequenceNumber, _other.m_sequenceNumber); } -bool KnownState::operator==(const KnownState& _other) const +bool KnownState::operator==(KnownState const& _other) const { if (m_storageContent != _other.m_storageContent || m_memoryContent != _other.m_memoryContent) return false; |