Merge pull request #8978 from ethereum/disturbance_stack

Add proper unipmlemented errors for array copying
This commit is contained in:
chriseth
2020-05-25 15:34:45 +02:00
committed by GitHub
8 changed files with 73 additions and 1 deletions
+7
View File
@@ -185,6 +185,13 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons
{
solAssert(byteOffsetSize == 0, "Byte offset for array as base type.");
auto const& sourceBaseArrayType = dynamic_cast<ArrayType const&>(*sourceBaseType);
solUnimplementedAssert(
_sourceType.location() != DataLocation::CallData ||
!_sourceType.isDynamicallyEncoded() ||
!sourceBaseArrayType.isDynamicallySized(),
"Copying nested calldata dynamic arrays to storage is not implemented in the old code generator."
);
_context << Instruction::DUP3;
if (sourceBaseArrayType.location() == DataLocation::Memory)
_context << Instruction::MLOAD;
+8
View File
@@ -974,6 +974,14 @@ void CompilerUtils::convertType(
}
else
{
if (auto baseType = dynamic_cast<ArrayType const*>(typeOnStack.baseType()))
solUnimplementedAssert(
typeOnStack.location() != DataLocation::CallData ||
!typeOnStack.isDynamicallyEncoded() ||
!baseType->isDynamicallySized(),
"Copying nested dynamic calldata arrays to memory is not implemented in the old code generator."
);
m_context << u256(0) << Instruction::SWAP1;
// stack: <mem start> <source ref> (variably sized) <length> <counter> <mem data pos>
auto repeat = m_context.newTag();