mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6132 from ethereum/ossfuzz-nullref-typechecker
TypeChecker: Check if type exists before dereferencing it
This commit is contained in:
@@ -632,6 +632,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
||||
bool requiresStorage = ref->second.isSlot || ref->second.isOffset;
|
||||
if (auto var = dynamic_cast<VariableDeclaration const*>(declaration))
|
||||
{
|
||||
solAssert(var->type(), "Expected variable type!");
|
||||
if (var->isConstant())
|
||||
{
|
||||
m_errorReporter.typeError(_identifier.location, "Constant variables not supported by inline assembly.");
|
||||
@@ -1012,6 +1013,14 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
|
||||
}
|
||||
}
|
||||
|
||||
if (valueTypes.size() != variables.size())
|
||||
{
|
||||
solAssert(m_errorReporter.hasErrors(), "Should have errors!");
|
||||
for (auto const& var: variables)
|
||||
if (var && !var->annotation().type)
|
||||
BOOST_THROW_EXCEPTION(FatalError());
|
||||
}
|
||||
|
||||
if (autoTypeDeductionNeeded)
|
||||
{
|
||||
if (!typeCanBeExpressed(variables))
|
||||
|
||||
Reference in New Issue
Block a user