diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-21 20:19:55 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-21 20:19:55 +0000 |
commit | e5cdd080ba9f165d348a26034114e27af64fdc23 (patch) | |
tree | 3e972ad44942dea2d79ba64a3048c862cd4aaa77 /clang/lib/Lex/Lexer.cpp | |
parent | df5133455f34f063a0dee2d13bbed3bb9f5ecad5 (diff) | |
download | bcm5719-llvm-e5cdd080ba9f165d348a26034114e27af64fdc23.tar.gz bcm5719-llvm-e5cdd080ba9f165d348a26034114e27af64fdc23.zip |
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.
llvm-svn: 147091
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 25e320df512..acb5b8a797e 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/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); } |