This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: egcs-1.1.2 cpp SEGV on omitted stringified rest arg
- To: Nathan Kurz <nate at valleytel dot net>
- Subject: Re: PATCH: egcs-1.1.2 cpp SEGV on omitted stringified rest arg
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Sun, 31 Oct 1999 01:09:37 -0700
- cc: egcs-bugs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <199907232348.SAA21468@trinkpad.valleytel.net>you write:
> Hello --
>
> I recently encountered a bug in cpp, and since I had a little extra
> time I decided to track it down. The bug tends to occur when you
> attempt to stringify an omitted rest arg, like this:
>
> #define MACRO(dummy,args...) function(dummy,#args)
> MACRO(1);
>
> This should evaluate to 'function(1,"");', but instead tends to result
> in a SEGV in cpp. As it turns out, cccp.c:macarg() is not called for
> omitted arguments. This means that no room is left for "" when
> xbuf_len is calculated, and thus cccp.c:macroexpand() writes beyond
> the end of the space allocated for xbuf.
>
> The bug exists on at least these two systems and egcs versions:
>
> Linux wso 2.2.10 #1 SMP Tue Jun 15 23:58:04 EDT 1999 i686 unknown
> GNU CPP version egcs-2.91.66 Debian GNU/Linux (egcs-1.1.2 release)
> (i386 Linux/ELF)
>
> Linux trinkpad 2.0.35 #3 Thu Oct 22 19:19:19 EDT 1998 i586 unknown
> GNU CPP version egcs-2.90.29 980515 (egcs-1.0.3 release)
> (i386 Linux/ELF)
>
> But judging by the source code, it probably exists everywhere...
Thanks. Your patch is somewhat out of date -- egcs-1.1.2 is rather
old... I updated your patch to apply to the current sources and
installed the bugfix.
jeff
patch