diff options
author | chriseth <chris@ethereum.org> | 2018-05-15 20:44:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-15 20:44:39 +0800 |
commit | dce62240525035ec7ce6b5d1b76bfeebe1ae9546 (patch) | |
tree | 6ff6bb000cbdbe6d0db608a2bb7bab3360c47352 /libsolidity | |
parent | b8b460994ff3cb9f01c4c1c063305a8651a10bb5 (diff) | |
parent | c03a29dea8cf8718d34a4776534be0c75cc4c8c3 (diff) | |
download | dexon-solidity-dce62240525035ec7ce6b5d1b76bfeebe1ae9546.tar.gz dexon-solidity-dce62240525035ec7ce6b5d1b76bfeebe1ae9546.tar.zst dexon-solidity-dce62240525035ec7ce6b5d1b76bfeebe1ae9546.zip |
Merge pull request #4062 from ethereum/revert-variable
Fix revert with reason coming from a string variable
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/codegen/CompilerUtils.cpp | 1 | ||||
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index a39e799c..d9f17263 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -89,7 +89,6 @@ void CompilerUtils::revertWithStringData(Type const& _argumentType) abiEncode({_argumentType.shared_from_this()}, {make_shared<ArrayType>(DataLocation::Memory, true)}); toSizeAfterFreeMemoryPointer(); m_context << Instruction::REVERT; - m_context.adjustStackOffset(_argumentType.sizeOnStack()); } unsigned CompilerUtils::loadFromMemory( diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index a8222e21..4bcc1fa9 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -933,7 +933,11 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) // condition was not met, flag an error m_context.appendInvalid(); else if (arguments.size() > 1) + { utils().revertWithStringData(*arguments.at(1)->annotation().type); + // Here, the argument is consumed, but in the other branch, it is still there. + m_context.adjustStackOffset(arguments.at(1)->annotation().type->sizeOnStack()); + } else m_context.appendRevert(); // the success branch |