Preprocessor allocate buffer using mmap() or malloc() for reading include files at cppfiles.c / read_include_file(). When using malloc(), the buffer can be NUL-terminated. But using mmap(), the buffer cannot be NUL-terminated. Almost implementation of mmap() are NUL-terminated after the mmap()ed file data. But XFS(SGI's file system) on Linux is different. So everywhere reading buffer like 'buffer->cur++', must check buffer overflow. For example, at cpplex.c / _cpp_lex_direct(), > skipped_white: + if( buffer->cur > buffer->rlimit ) + c = '\0'; + else > c = *buffer->cur++; > result->col = CPP_BUF_COLUMN (buffer, buffer->cur);
It is a bug in XFS then because this is behavior which the 3.3.x preprocessor depepended on but this is fixed for 3.4.0 by no longer using mmap on a file.
Just to confirm what Andrew said: The Single Unix Standard *requires* mmap to zero-fill to a page boundary. Not doing this is a potential security hole. Report this to the XFS developers as a critical bug. GCC 3.4 does not use mmap and will not be affected by the bug. zw