summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCpp/Lexer.cpp
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-02-10 22:15:38 +0200
committerAndreas Kling <kling@serenityos.org>2021-02-13 19:50:09 +0100
commit8ace2cfa1848ad4402b0c8ffa1875d6d9bffec10 (patch)
treee143ccbd7abc8c5acadad70a59f667a2d06ef63b /Userland/Libraries/LibCpp/Lexer.cpp
parent2da5ecba41ca7cc6212cce8e27e082723e6f6782 (diff)
downloadserenity-8ace2cfa1848ad4402b0c8ffa1875d6d9bffec10.zip
LibCpp: Fix lexing & parsing of non-terminated strings
Diffstat (limited to 'Userland/Libraries/LibCpp/Lexer.cpp')
-rw-r--r--Userland/Libraries/LibCpp/Lexer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCpp/Lexer.cpp b/Userland/Libraries/LibCpp/Lexer.cpp
index 5273f87dd4..0507f11ec3 100644
--- a/Userland/Libraries/LibCpp/Lexer.cpp
+++ b/Userland/Libraries/LibCpp/Lexer.cpp
@@ -640,6 +640,10 @@ Vector<Token> Lexer::lex()
}
}
+ // If string is not terminated - stop before EOF
+ if (!peek(1))
+ break;
+
if (consume() == '"')
break;
}