aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/CompilerContext.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-05-24 17:47:43 +0800
committerchriseth <chris@ethereum.org>2017-06-24 01:29:11 +0800
commit831ed083875b73faf91f9d3335e2599540366712 (patch)
tree9483dd02d12267cab05078f140b094ad40841a14 /libsolidity/codegen/CompilerContext.cpp
parentb83f77e0e567b58c2ada831e526ad5bacfed8b40 (diff)
downloaddexon-solidity-831ed083875b73faf91f9d3335e2599540366712.tar.gz
dexon-solidity-831ed083875b73faf91f9d3335e2599540366712.tar.zst
dexon-solidity-831ed083875b73faf91f9d3335e2599540366712.zip
Change invalid opcode to revert for input validation.
Diffstat (limited to 'libsolidity/codegen/CompilerContext.cpp')
-rw-r--r--libsolidity/codegen/CompilerContext.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp
index 9d0d6d37..1937b529 100644
--- a/libsolidity/codegen/CompilerContext.cpp
+++ b/libsolidity/codegen/CompilerContext.cpp
@@ -244,6 +244,20 @@ CompilerContext& CompilerContext::appendConditionalInvalid()
return *this;
}
+CompilerContext& CompilerContext::appendRevert()
+{
+ return *this << u256(0) << u256(0) << Instruction::REVERT;
+}
+
+CompilerContext& CompilerContext::appendConditionalRevert()
+{
+ *this << Instruction::ISZERO;
+ eth::AssemblyItem afterTag = appendConditionalJump();
+ appendRevert();
+ *this << afterTag;
+ return *this;
+}
+
void CompilerContext::resetVisitedNodes(ASTNode const* _node)
{
stack<ASTNode const*> newStack;