Invalid read of size 1

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

Does this help?

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080407/005128.html

-Chris

Chris Lattner wrote:

Does this help?

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080407/005128.html

Yep. Thanks!

Sam