From tlumley at u.washington.edu  Fri May 13 02:20:51 2005
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Fri May 13 02:21:10 2005
Subject: [Rd] segfault on large number of open brackets (PR#7859)
In-Reply-To: <Pine.LNX.4.61.0505122248370.13448@gannet.stats>
References: <20050512174954.23B69E17A@slim.kubism.ku.dk>
	<Pine.LNX.4.61.0505122248370.13448@gannet.stats>
Message-ID: <Pine.A41.4.61b.0505121719520.136304@homer08.u.washington.edu>


And this also fixes PR#7022 (a highly nested polynomial)

 	-thomas

On Thu, 12 May 2005, Prof Brian Ripley wrote:

> On Thu, 12 May 2005 ripley@stats.ox.ac.uk wrote:
>
>> I suspect that is coincidence, as I can see no source change that would
>> account for it.
>> 
>> 2.0.1 and R-devel work for me and 2.1.0 segfaults with
>> 
>> 999         KeepSource = *LOGICAL(GetOption(install("keep.source"), 
>> R_NilValue));
>> (gdb) bt
>> #0  0x080ca229 in ParseInit () at gram.y:999
>> #1  0x080cb305 in token () at gram.y:1530
>> 
>> I am not sure that is right, but I am pretty sure that
>> 
>> static char	contextstack[50], *contextp;
>> 
>> just above is an unchecked nesting limit, as in
>> 
>> static void IfPush(void)
>> {
>>     if (*contextp==LBRACE ||
>> 	*contextp=='['    ||
>> 	*contextp=='('    ||
>> 	*contextp == 'i')
>> 	    *++contextp = 'i';
>> }
>> 
>> However, although I thought this was the problem, it seems only to apply
>> to nested if()s.  So I do not currently have a solution.
>
> I was almost right, just a different instance of *++contextp.
>
> Fixed in R-patched, to give
>
>> (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
> Error: contextstack overflow
>
>
> -- 
> Brian D. Ripley,                  ripley@stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle


[Rd] segfault on large number of open brackets (PR#7859)
Thomas Lumley