aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-12-21 20:19:55 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-12-21 20:19:55 +0000
commitf132dcaae82ebfc44c4fe0e84bf0b1f95e9d1251 (patch)
tree8de14f9f4d134001c07557f07392a96626f7ba45 /lib/Lex/Lexer.cpp
parent97bbab2df74cbfe221fb20454738d607a41f3ca4 (diff)
In Lexer::getCharAndSizeSlow[NoWarn] make sure we don't go over the end of the buffer
when the end of the buffer is immediately after an escaped newline. Fixes http://llvm.org/PR10153. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r--lib/Lex/Lexer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index 25e320df51..acb5b8a797 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -1171,6 +1171,10 @@ Slash:
// Found backslash<whitespace><newline>. Parse the char after it.
Size += EscapedNewLineSize;
Ptr += EscapedNewLineSize;
+
+ if (Ptr[0] == '\0')
+ return '\\';
+
// Use slow version to accumulate a correct size field.
return getCharAndSizeSlow(Ptr, Size, Tok);
}
@@ -1222,6 +1226,9 @@ Slash:
Size += EscapedNewLineSize;
Ptr += EscapedNewLineSize;
+ if (Ptr[0] == '\0')
+ return '\\';
+
// Use slow version to accumulate a correct size field.
return getCharAndSizeSlowNoWarn(Ptr, Size, Features);
}