[PATCH] cpp segfault fix

Jakub Jelinek jakub@redhat.com
Tue Aug 1 02:46:00 GMT 2000


On Mon, Jul 31, 2000 at 04:25:06PM -0700, Zack Weinberg wrote:
> On Mon, Jul 31, 2000 at 12:42:05PM +0200, Jakub Jelinek wrote:
> > Hi!
> > 
> > cpp segfaults on 64bit arches when given a directory as argument instead of
> > exiting with
> > <command line>: /tmp is a directory
> > The issue is that in _cpp_get_line we get index 0 and try to read from
> > tokens[0xffffffff]. Even reading from tokens[-1] on 32bit arches does not seem
> > to be a good idea to me though.
> 
> Good catch. I'd rather write if (index == 0) in this context - I'll
> apply the patch with that change.
> 
> Is it possible to trigger this bug by writing "#include </tmp>" in a
> file, and if so, can you add a test case, please?

No, it needs to come up from the command line (because otherwise is index
non-zero), so the issue is how to tell the testsuite to pass /tmp to command
line instead of some filename.

	Jakub


More information about the Gcc-patches mailing list