mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Abort early if there is nothing to encode or decode.
This commit is contained in:
parent
735c977db1
commit
71d866cd7a
@ -180,6 +180,9 @@ void CompilerUtils::encodeToMemory(
|
|||||||
t = t->mobileType()->interfaceType(_encodeAsLibraryTypes)->encodingType();
|
t = t->mobileType()->interfaceType(_encodeAsLibraryTypes)->encodingType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_givenTypes.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
// Stack during operation:
|
// Stack during operation:
|
||||||
// <v1> <v2> ... <vn> <mem_start> <dyn_head_1> ... <dyn_head_r> <end_of_mem>
|
// <v1> <v2> ... <vn> <mem_start> <dyn_head_1> ... <dyn_head_r> <end_of_mem>
|
||||||
// The values dyn_head_i are added during the first loop and they point to the head part
|
// The values dyn_head_i are added during the first loop and they point to the head part
|
||||||
|
@ -299,9 +299,12 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac
|
|||||||
|
|
||||||
// Return tag is used to jump out of the function.
|
// Return tag is used to jump out of the function.
|
||||||
eth::AssemblyItem returnTag = m_context.pushNewTag();
|
eth::AssemblyItem returnTag = m_context.pushNewTag();
|
||||||
|
if (!functionType->parameterTypes().empty())
|
||||||
|
{
|
||||||
// Parameter for calldataUnpacker
|
// Parameter for calldataUnpacker
|
||||||
m_context << CompilerUtils::dataStartOffset;
|
m_context << CompilerUtils::dataStartOffset;
|
||||||
appendCalldataUnpacker(functionType->parameterTypes());
|
appendCalldataUnpacker(functionType->parameterTypes());
|
||||||
|
}
|
||||||
m_context.appendJumpTo(m_context.functionEntryLabel(functionType->declaration()));
|
m_context.appendJumpTo(m_context.functionEntryLabel(functionType->declaration()));
|
||||||
m_context << returnTag;
|
m_context << returnTag;
|
||||||
// Return tag and input parameters get consumed.
|
// Return tag and input parameters get consumed.
|
||||||
|
Loading…
Reference in New Issue
Block a user