Merge pull request #9030 from ethereum/issue-8923

Fix ICE when trying to decode too large static arrays
This commit is contained in:
chriseth 2020-05-27 11:45:39 +02:00 committed by GitHub
commit 1bf706085d
3 changed files with 21 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Bugfixes:
* Type Checker: Disallow assignments to storage variables of type ``mapping``.
* Type Checker: Disallow inline arrays of non-nameable types.
* Type Checker: Fix internal compiler error when accessing members of array slices.
* Type Checker: Fix internal compiler error when trying to decode too large static arrays.
* NatSpec: DocString block is terminated when encountering an empty line.
* Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL.
* Code Generator: Trigger proper unimplemented errors on certain array copy operations.

View File

@ -193,6 +193,18 @@ TypePointers TypeChecker::typeCheckABIDecodeAndRetrieveReturnType(FunctionCall c
typeArgument->location(),
"Decoding type " + actualType->toString(false) + " not supported."
);
if (auto referenceType = dynamic_cast<ReferenceType const*>(actualType))
{
auto result = referenceType->validForLocation(referenceType->location());
if (!result)
m_errorReporter.typeError(
6118_error,
typeArgument->location(),
result.message()
);
}
components.push_back(actualType);
}
else

View File

@ -0,0 +1,8 @@
// Used to cause ICE
contract C {
function f() public {
abi.decode("", (byte[999999999]));
}
}
// ----
// TypeError: (75-90): Type too large for memory.