[cfe-dev] Invalid read of size 1

Chris Lattner clattner at apple.com
Fri Apr 11 09:21:15 PDT 2008


On Apr 11, 2008, at 8:56 AM, Sam Bishop wrote:

> 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?

Does this help?

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

-Chris



More information about the cfe-dev mailing list