aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ContractCompiler.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-26 07:06:20 +0800
committerGitHub <noreply@github.com>2017-06-26 07:06:20 +0800
commit29b8cdb594044525b398994fe9855fbbdb76981b (patch)
tree4d3b3a3706c4a89194f728cca37a6c457c5857fb /libsolidity/codegen/ContractCompiler.cpp
parentb83f77e0e567b58c2ada831e526ad5bacfed8b40 (diff)
parent784b72bb72631f134fbbc0cc3b7acc109dd3f785 (diff)
downloaddexon-solidity-29b8cdb594044525b398994fe9855fbbdb76981b.tar
dexon-solidity-29b8cdb594044525b398994fe9855fbbdb76981b.tar.gz
dexon-solidity-29b8cdb594044525b398994fe9855fbbdb76981b.tar.bz2
dexon-solidity-29b8cdb594044525b398994fe9855fbbdb76981b.tar.lz
dexon-solidity-29b8cdb594044525b398994fe9855fbbdb76981b.tar.xz
dexon-solidity-29b8cdb594044525b398994fe9855fbbdb76981b.tar.zst
dexon-solidity-29b8cdb594044525b398994fe9855fbbdb76981b.zip
Merge pull request #2298 from ethereum/fixThrowRevert
Change invalid opcode to revert for input validation.
Diffstat (limited to 'libsolidity/codegen/ContractCompiler.cpp')
-rw-r--r--libsolidity/codegen/ContractCompiler.cpp9
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;
}