fix a potential buffer overrun that Eli noticed

llvm-svn: 56879
This commit is contained in:
Chris Lattner 2008-09-30 20:51:14 +00:00
parent 106ab3bb42
commit 8b567f9713
1 changed files with 7 additions and 0 deletions

View File

@ -523,6 +523,13 @@ Action::ExprResult Sema::ActOnNumericConstant(const Token &Tok) {
// 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)