Merge pull request #7664 from ethereum/smt_fixed_bytes_index_access

Fix ICE in FixedBytes IndexAccess
This commit is contained in:
Leonardo 2019-11-08 19:27:05 +01:00 committed by GitHub
commit 78be93856b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Bugfixes:
* Type Checker: Disallow constructor of the same class to be used as modifier
* Code Generator: Fixed a faulty assert that would wrongly trigger for array sizes exceeding unsigned integer
* Type Checker: Treat magic variables as unknown identifiers in inline assembly
* SMTChecker: Fix internal error when accessing indices of fixed bytes.

View File

@ -766,6 +766,15 @@ void SMTEncoder::endVisit(IndexAccess const& _indexAccess)
auto varDecl = identifierToVariable(*id);
solAssert(varDecl, "");
array = m_context.variable(*varDecl);
if (varDecl->type()->category() == Type::Category::FixedBytes)
{
m_errorReporter.warning(
_indexAccess.location(),
"Assertion checker does not yet support index accessing fixed bytes."
);
return;
}
}
else if (auto const& innerAccess = dynamic_cast<IndexAccess const*>(&_indexAccess.baseExpression()))
{

View File

@ -0,0 +1,10 @@
pragma experimental SMTChecker;
contract C {
bytes20 x;
function f(bytes16 b) public view {
b[uint8(x[2])];
}
}
// ----
// Warning: (116-120): Assertion checker does not yet support index accessing fixed bytes.
// Warning: (108-122): Assertion checker does not yet support index accessing fixed bytes.