From ac6871078940f0ae4a47380091fc46ed46a63d0a Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 22 May 2018 17:37:21 +0200 Subject: Disallow trailing dots that are not followed by a number --- libsolidity/parsing/Scanner.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libsolidity') diff --git a/libsolidity/parsing/Scanner.cpp b/libsolidity/parsing/Scanner.cpp index 6541f6c2..801d2cc4 100644 --- a/libsolidity/parsing/Scanner.cpp +++ b/libsolidity/parsing/Scanner.cpp @@ -768,8 +768,14 @@ Token::Value Scanner::scanNumber(char _charSeen) scanDecimalDigits(); // optional if (m_char == '.') { + // A '.' has to be followed by a number. + if (m_source.isPastEndOfInput() || !isDecimalDigit(m_source.get(1))) + { + literal.complete(); + return Token::Number; + } addLiteralCharAndAdvance(); - scanDecimalDigits(); // optional + scanDecimalDigits(); } } } -- cgit v1.2.3