summaryrefslogtreecommitdiffstats
path: root/lib/Lex
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-10-11 00:41:20 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-10-11 00:41:20 +0000
commitbd279d876518592ad5ddf5c9aee15bef8d551f0c (patch)
treef4936d1b485f1ced7a7a944fe84dc0d75284c6a6 /lib/Lex
parent4da3addc80e3d74bd6b174c7160f6151335bfc15 (diff)
A '<' with a trigraph '#' is not a valid editor placeholder
Credit to OSS-Fuzz for discovery: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3137#c5 rdar://34923985 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315398 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/Lexer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index 9885ab9d3e..0c179c0fb8 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -3542,7 +3542,8 @@ LexNextToken:
} else if (LangOpts.Digraphs && Char == '%') { // '<%' -> '{'
CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
Kind = tok::l_brace;
- } else if (Char == '#' && lexEditorPlaceholder(Result, CurPtr)) {
+ } else if (Char == '#' && /*Not a trigraph*/ SizeTmp == 1 &&
+ lexEditorPlaceholder(Result, CurPtr)) {
return true;
} else {
Kind = tok::less;