diff options
author | Volodymyr Sapsai <vsapsai@apple.com> | 2018-01-12 18:54:35 +0000 |
---|---|---|
committer | Volodymyr Sapsai <vsapsai@apple.com> | 2018-01-12 18:54:35 +0000 |
commit | abb8dfc1146858cbdf920e0801e055c971ef6de5 (patch) | |
tree | cd02816632c0c4c0bd84ca3a932b3e45ca9841c7 /clang/unittests/Lex/LexerTest.cpp | |
parent | 0bf9c5eee5d37a1334ec66af8ca3d2420151a6be (diff) | |
download | llvm-abb8dfc1146858cbdf920e0801e055c971ef6de5.zip llvm-abb8dfc1146858cbdf920e0801e055c971ef6de5.tar.gz llvm-abb8dfc1146858cbdf920e0801e055c971ef6de5.tar.bz2 |
[Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.
Fix makes the loop in LexAngledStringLiteral more like the loops in
LexStringLiteral, LexCharConstant. When we skip a character after
backslash, we need to check if we reached the end of the file instead of
reading the next character unconditionally.
Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3832
rdar://problem/35572754
Reviewers: arphaman, kcc, rsmith, dexonsmith
Reviewed By: rsmith, dexonsmith
Subscribers: cfe-commits, rsmith, dexonsmith
Differential Revision: https://reviews.llvm.org/D41423
llvm-svn: 322390
Diffstat (limited to 'clang/unittests/Lex/LexerTest.cpp')
-rw-r--r-- | clang/unittests/Lex/LexerTest.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/unittests/Lex/LexerTest.cpp b/clang/unittests/Lex/LexerTest.cpp index 746d08a..216672a 100644 --- a/clang/unittests/Lex/LexerTest.cpp +++ b/clang/unittests/Lex/LexerTest.cpp @@ -475,6 +475,8 @@ TEST_F(LexerTest, GetBeginningOfTokenWithEscapedNewLine) { TEST_F(LexerTest, AvoidPastEndOfStringDereference) { EXPECT_TRUE(Lex(" // \\\n").empty()); + EXPECT_TRUE(Lex("#include <\\\\").empty()); + EXPECT_TRUE(Lex("#include <\\\\\n").empty()); } TEST_F(LexerTest, StringizingRasString) { |