[cfe-commits] r56879 - /cfe/trunk/lib/Sema/SemaExpr.cpp
Chris Lattner
sabre at nondot.org
Tue Sep 30 13:51:14 PDT 2008
Author: lattner
Date: Tue Sep 30 15:51:14 2008
New Revision: 56879
URL: http://llvm.org/viewvc/llvm-project?rev=56879&view=rev
Log:
fix a potential buffer overrun that Eli noticed
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=56879&r1=56878&r2=56879&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Sep 30 15:51:14 2008
@@ -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)
More information about the cfe-commits
mailing list