summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Lex/LexerTest.cpp
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
commitd5bf436d3acd2bb4124ba44b5bca3193e68909ce (patch)
treea9d1a0b89b82dde3eced4453327ee8755131eba9 /clang/unittests/Lex/LexerTest.cpp
parent40e202f7d996f1ee0be33f8ddc20d2d207dfa939 (diff)
downloadbcm5719-llvm-d5bf436d3acd2bb4124ba44b5bca3193e68909ce.tar.gz
bcm5719-llvm-d5bf436d3acd2bb4124ba44b5bca3193e68909ce.zip
[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 llvm-svn: 315785
Diffstat (limited to 'clang/unittests/Lex/LexerTest.cpp')
-rw-r--r--clang/unittests/Lex/LexerTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/unittests/Lex/LexerTest.cpp b/clang/unittests/Lex/LexerTest.cpp
index 35eee121384..894f8c7fd89 100644
--- a/clang/unittests/Lex/LexerTest.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud