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

Thomas Lumley tlumley at u.washington.edu
Fri May 13 02:20:51 CEST 2005


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 at 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 at 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 at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

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



More information about the R-devel mailing list