mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow access to functions from inline assembly.
This commit is contained in:
parent
3f26f7fb7e
commit
3e649eb8e1
@ -9,6 +9,7 @@ Compiler Features:
|
|||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Inline Assembly: Fix internal error when accessing invalid constant variables.
|
* Inline Assembly: Fix internal error when accessing invalid constant variables.
|
||||||
|
* Inline Assembly: Fix internal error when accessing functions.
|
||||||
* Reference Resolver: Fix internal error when accessing invalid struct members.
|
* Reference Resolver: Fix internal error when accessing invalid struct members.
|
||||||
* Type Checker: Fix internal errors when assigning nested tuples.
|
* Type Checker: Fix internal errors when assigning nested tuples.
|
||||||
* Inheritance: Allow public state variables to override functions with dynamic memory types in their return values.
|
* Inheritance: Allow public state variables to override functions with dynamic memory types in their return values.
|
||||||
|
@ -740,6 +740,8 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
|||||||
solAssert(!!declaration->type(), "Type of declaration required but not yet determined.");
|
solAssert(!!declaration->type(), "Type of declaration required but not yet determined.");
|
||||||
if (dynamic_cast<FunctionDefinition const*>(declaration))
|
if (dynamic_cast<FunctionDefinition const*>(declaration))
|
||||||
{
|
{
|
||||||
|
m_errorReporter.declarationError(_identifier.location, "Access to functions is not allowed in inline assembly.");
|
||||||
|
return size_t(-1);
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<VariableDeclaration const*>(declaration))
|
else if (dynamic_cast<VariableDeclaration const*>(declaration))
|
||||||
{
|
{
|
||||||
|
@ -5,3 +5,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// DeclarationError: (72-73): Access to functions is not allowed in inline assembly.
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
contract C {
|
||||||
|
function f() public pure {}
|
||||||
|
constructor() public {
|
||||||
|
assembly {
|
||||||
|
let x := f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// DeclarationError: (112-113): Access to functions is not allowed in inline assembly.
|
Loading…
Reference in New Issue
Block a user