[cfe-dev] Invalid read of size 1

Sam Bishop sam at bishop.dhs.org
Fri Apr 11 08:56:12 PDT 2008


bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) {
  ...
  // If the file was empty or didn't end in a newline, issue a pedwarn.
  if (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')
    Diag(BufferEnd, diag::ext_no_newline_eof);
  ...
}

Does someone want to take this?  Valgrind is flagging it, and it does
look problematic.  If the file is empty, isn't CurPtr[-1] off the front
of the buffer?

Sam




More information about the cfe-dev mailing list