aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-05-04 10:18:52 +0800
committerchriseth <chris@ethereum.org>2018-05-09 23:53:17 +0800
commitc03a29dea8cf8718d34a4776534be0c75cc4c8c3 (patch)
treed08b5e5e1551618b9a017475ac11b5a9435026ee /libsolidity/codegen
parent868d449c38f66f541d1089da82a100d9aa05f4c5 (diff)
downloaddexon-solidity-c03a29dea8cf8718d34a4776534be0c75cc4c8c3.tar
dexon-solidity-c03a29dea8cf8718d34a4776534be0c75cc4c8c3.tar.gz
dexon-solidity-c03a29dea8cf8718d34a4776534be0c75cc4c8c3.tar.bz2
dexon-solidity-c03a29dea8cf8718d34a4776534be0c75cc4c8c3.tar.lz
dexon-solidity-c03a29dea8cf8718d34a4776534be0c75cc4c8c3.tar.xz
dexon-solidity-c03a29dea8cf8718d34a4776534be0c75cc4c8c3.tar.zst
dexon-solidity-c03a29dea8cf8718d34a4776534be0c75cc4c8c3.zip
Fix revert with reason coming from a string variable
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp1
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp4
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