diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-01-10 01:30:14 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-01-10 21:16:46 +0800 |
commit | 8b20a7cd53b04a4b3b3e26df4ddd9ad81d28bb1b (patch) | |
tree | 24ae6722975b86c4702d12feb825f3e3aa8663c5 /libsolidity/inlineasm | |
parent | 42f88757708c42f447572c9b96da06c06329e9bc (diff) | |
download | dexon-solidity-8b20a7cd53b04a4b3b3e26df4ddd9ad81d28bb1b.tar.gz dexon-solidity-8b20a7cd53b04a4b3b3e26df4ddd9ad81d28bb1b.tar.zst dexon-solidity-8b20a7cd53b04a4b3b3e26df4ddd9ad81d28bb1b.zip |
Disallow non-functional instructions in parseExpression early
Diffstat (limited to 'libsolidity/inlineasm')
-rw-r--r-- | libsolidity/inlineasm/AsmParser.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 88a0afc1..306b07e6 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -265,10 +265,13 @@ assembly::Expression Parser::parseExpression() instructionNames().at(instr.instruction) + "\" not allowed in this context." ); + if (m_flavour != AsmFlavour::Loose && currentToken() != Token::LParen) + fatalParserError( + "Non-functional instructions are not allowed in this context." + ); // Enforce functional notation for instructions requiring multiple arguments. int args = instructionInfo(instr.instruction).args; - bool requireFunctionalNotation = (args > 0 || m_flavour != AsmFlavour::Loose); - if (requireFunctionalNotation && currentToken() != Token::LParen) + if (args > 0 && currentToken() != Token::LParen) fatalParserError(string( "Expected token \"(\" (\"" + instructionNames().at(instr.instruction) + |