[cfe-commits] r161780 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/CodeGen/ms-inline-asm.c
Dmitri Gribenko
gribozavr at gmail.com
Mon Aug 13 13:55:32 PDT 2012
On Mon, Aug 13, 2012 at 1:32 PM, Chad Rosier <mcrosier at apple.com> wrote:
> + case tok::numeric_constant: {
> + SmallString<32> TokenBuf;
> + TokenBuf.resize(32);
> + bool StringInvalid = false;
> + const char *ThisTokBuf = &TokenBuf[0];
> + unsigned ThisTokLen =
> + Lexer::getSpelling(AsmToks[j], ThisTokBuf, SemaRef.getSourceManager(),
> + SemaRef.getLangOpts(), &StringInvalid);
> + Asm += StringRef(ThisTokBuf, ThisTokLen);
> break;
> }
This sounds like a buffer overflow... It would be better to use
another Lexer::getSpelling() overload that returns StringRef. Or you
could use Preprocessor::getSpelling().
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list