Disable large arrays for memory location too

This commit is contained in:
Alex Beregszaszi 2017-07-13 17:02:10 +02:00
parent e640bb2aed
commit 4229caaadc
2 changed files with 6 additions and 2 deletions

View File

@ -586,7 +586,11 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
if (varType->category() == Type::Category::Array)
if (auto arrayType = dynamic_cast<ArrayType const*>(varType.get()))
if ((arrayType->location() == DataLocation::CallData) && !arrayType->validForCalldata())
if (
((arrayType->location() == DataLocation::Memory) ||
(arrayType->location() == DataLocation::CallData)) &&
!arrayType->validForCalldata()
)
m_errorReporter.typeError(_variable.location(), "Array is too large to be encoded as calldata.");
return false;

View File

@ -6319,7 +6319,7 @@ BOOST_AUTO_TEST_CASE(too_large_arrays_for_calldata)
}
}
)";
CHECK_SUCCESS_NO_WARNINGS(text);
CHECK_ERROR(text, TypeError, "Array is too large to be encoded as calldata.");
}
BOOST_AUTO_TEST_SUITE_END()