Merge pull request #6111 from ethereum/fuzz-crash-smt

Fix SMT Checker crash due to missing type information
This commit is contained in:
Alex Beregszaszi 2019-02-28 13:19:32 +00:00 committed by GitHub
commit 8b6049b733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -448,6 +448,9 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
)
m_errorReporter.typeError(_variable.location(), "Variables cannot be declared in interfaces.");
if (_variable.typeName())
_variable.typeName()->accept(*this);
// type is filled either by ReferencesResolver directly from the type name or by
// TypeChecker at the VariableDeclarationStatement level.
TypePointer varType = _variable.annotation().type;

View File

@ -695,6 +695,7 @@ void SMTChecker::visitFunctionIdentifier(Identifier const& _identifier)
void SMTChecker::endVisit(Literal const& _literal)
{
solAssert(_literal.annotation().type, "Expected type for AST node");
Type const& type = *_literal.annotation().type;
if (isNumber(type.category()))

View File

@ -3,6 +3,10 @@ contract C
{
// Used to crash because Literal had no type
int[3] d;
// Used to crash because Literal had no type
int[3*1] x;
}
// ----
// Warning: (92-100): Assertion checker does not yet support the type of this variable.
// Warning: (149-159): Assertion checker does not yet support the type of this variable.
// Warning: (153-156): Assertion checker does not yet implement this operator on non-integer types.