fix a potential buffer overrun that Eli noticed
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56879 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 07428fd..6125718 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -523,6 +523,13 @@
// Get the spelling of the token, which eliminates trigraphs, etc.
unsigned ActualLength = PP.getSpelling(Tok, ThisTokBegin);
+
+ // Add padding so that NumericLiteralParser can overread by one character.
+ if (!IntegerBuffer.empty()) {
+ IntegerBuffer.push_back(' ');
+ ThisTokBegin = &IntegerBuffer[0];
+ }
+
NumericLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength,
Tok.getLocation(), PP);
if (Literal.hadError)