diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-10-08 06:59:30 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2016-10-20 03:44:15 +0800 |
commit | 9616470f67675d7cd4a2a3df001302d87417b03f (patch) | |
tree | f4a244abc946400f0f6feaaafae43e4514387169 | |
parent | 3bcf0909afca0019841a343ee19ea7dbeef9d667 (diff) | |
download | dexon-solidity-9616470f67675d7cd4a2a3df001302d87417b03f.tar dexon-solidity-9616470f67675d7cd4a2a3df001302d87417b03f.tar.gz dexon-solidity-9616470f67675d7cd4a2a3df001302d87417b03f.tar.bz2 dexon-solidity-9616470f67675d7cd4a2a3df001302d87417b03f.tar.lz dexon-solidity-9616470f67675d7cd4a2a3df001302d87417b03f.tar.xz dexon-solidity-9616470f67675d7cd4a2a3df001302d87417b03f.tar.zst dexon-solidity-9616470f67675d7cd4a2a3df001302d87417b03f.zip |
Disallow magic variables in inline assembly
-rw-r--r-- | Changelog.md | 3 | ||||
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Changelog.md b/Changelog.md index a5a85eb5..d2efebce 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,9 @@ Bugfixes: * Code Generator: expect zero stack increase after `super` as an expression * Inline assembly: support the `address` opcode * Inline assembly: fix parsing of assignment after a label. + * Inline assembly: external variables of unsupported type (such as `this`, `super`, etc.) + are properly detected. They are not available in inline assembly and can be used as + local variable names. ### 0.4.2 (2016-09-17) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index ae7c13c8..b9b182c0 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -592,6 +592,10 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) unsigned pushes = 0; if (dynamic_cast<FunctionDefinition const*>(declaration)) pushes = 1; + else if (dynamic_cast<MagicVariableDeclaration const*>(declaration)) + { + return false; + } else if (auto var = dynamic_cast<VariableDeclaration const*>(declaration)) { if (var->isConstant()) |