diff options
author | chriseth <chris@ethereum.org> | 2017-05-24 17:47:43 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-06-24 01:29:11 +0800 |
commit | 831ed083875b73faf91f9d3335e2599540366712 (patch) | |
tree | 9483dd02d12267cab05078f140b094ad40841a14 /libsolidity/codegen/ContractCompiler.cpp | |
parent | b83f77e0e567b58c2ada831e526ad5bacfed8b40 (diff) | |
download | dexon-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/ContractCompiler.cpp')
-rw-r--r-- | libsolidity/codegen/ContractCompiler.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index dc090634..ace82ad4 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -111,7 +111,7 @@ void ContractCompiler::appendCallValueCheck() { // Throw if function is not payable but call contained ether. m_context << Instruction::CALLVALUE; - m_context.appendConditionalInvalid(); + m_context.appendConditionalRevert(); } void ContractCompiler::appendInitAndConstructorCode(ContractDefinition const& _contract) @@ -276,7 +276,7 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac appendReturnValuePacker(FunctionType(*fallback).returnParameterTypes(), _contract.isLibrary()); } else - m_context.appendInvalid(); + m_context.appendRevert(); for (auto const& it: interfaceFunctions) { @@ -368,7 +368,7 @@ void ContractCompiler::appendCalldataUnpacker(TypePointers const& _typeParameter // copy to memory // move calldata type up again CompilerUtils(m_context).moveIntoStack(calldataType->sizeOnStack()); - CompilerUtils(m_context).convertType(*calldataType, arrayType); + CompilerUtils(m_context).convertType(*calldataType, arrayType, false, false, true); // fetch next pointer again CompilerUtils(m_context).moveToStackTop(arrayType.sizeOnStack()); } @@ -805,8 +805,7 @@ bool ContractCompiler::visit(Throw const& _throw) { CompilerContext::LocationSetter locationSetter(m_context, _throw); // Do not send back an error detail. - m_context << u256(0) << u256(0); - m_context << Instruction::REVERT; + m_context.appendRevert(); return false; } |