From 1b1f35762e7d761a6a97f825699972472ba44888 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 13 Jun 2017 18:38:55 +0200 Subject: Enforce function arguments when parsing functional instructions. --- libsolidity/inlineasm/AsmParser.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libsolidity/inlineasm') diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 68a9cb03..f9b073ba 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -174,6 +174,19 @@ assembly::Case Parser::parseCase() assembly::Statement Parser::parseExpression() { Statement operation = parseElementaryOperation(true); + if (operation.type() == typeid(Instruction)) + { + Instruction const& instr = boost::get(operation); + int args = instructionInfo(instr.instruction).args; + if (args > 0 && currentToken() != Token::LParen) + fatalParserError(string( + "Expected token \"(\" (\"" + + instructionNames().at(instr.instruction) + + "\" expects " + + boost::lexical_cast(args) + + " arguments)" + )); + } if (currentToken() == Token::LParen) return parseCall(std::move(operation)); else -- cgit v1.2.3