Merge pull request #5883 from ethereum/fixInlineAssembly

Do not provide access to external assembly variables from within functions.
This commit is contained in:
chriseth 2019-01-28 15:12:43 +01:00 committed by GitHub
commit e22a9ea5cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -336,9 +336,11 @@ void CompilerContext::appendInlineAssembly(
identifierAccess.resolve = [&]( identifierAccess.resolve = [&](
yul::Identifier const& _identifier, yul::Identifier const& _identifier,
yul::IdentifierContext, yul::IdentifierContext,
bool bool _insideFunction
) ) -> size_t
{ {
if (_insideFunction)
return size_t(-1);
auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name.str()); auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name.str());
return it == _localVariables.end() ? size_t(-1) : 1; return it == _localVariables.end() ? size_t(-1) : 1;
}; };