summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-10-14 01:18:30 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-10-14 01:18:30 +0000
commit4318ef1cb398b9b72aea287a815c09cfe68a2b27 (patch)
treef72aed4e25cc8028e61d4fc50144755577ce507e /unittests
parent3f58ee82b7f0389dcb25163e8356af73203d2582 (diff)
[Lex] Avoid out-of-bounds dereference in SkipLineComment
Credit to OSS-Fuzz for discovery: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3145 rdar://34526482 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Lex/LexerTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/unittests/Lex/LexerTest.cpp b/unittests/Lex/LexerTest.cpp
index 35eee12138..894f8c7fd8 100644
--- a/unittests/Lex/LexerTest.cpp
+++ b/unittests/Lex/LexerTest.cpp
@@ -473,4 +473,9 @@ TEST_F(LexerTest, GetBeginningOfTokenWithEscapedNewLine) {
}
}
+TEST_F(LexerTest, AvoidPastEndOfStringDereference) {
+ std::vector<Token> LexedTokens = Lex(" // \\\n");
+ EXPECT_TRUE(LexedTokens.empty());
+}
+
} // anonymous namespace