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

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu May 12 19:49:54 CEST 2005


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.


On Thu, 12 May 2005 andy_liaw at merck.com wrote:

> I believe that's been fixed in R-2.1.0.  Please check.
>
> I got the same segfault with R-2.0.1 on SuSE Linux x86_64, but on both that
> machine and my WinXP latop, I get syntax error.  E.g.,
>
> R : Copyright 2005, The R Foundation for Statistical Computing
> Version 2.1.0 Patched (2005-05-12), ISBN 3-900051-07-0
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>  Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for a HTML browser interface to help.
> Type 'q()' to quit R.
>
>> (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
> + (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
> Error: syntax error
>
> Andy
>
>
>> From: m.e.bruche at lse.ac.uk
>>
>> Full_Name: Max
>> Version: R 2.0.1 (2004-11-15)
>> OS: Gentoo Linux
>> Submission from: (NULL) (158.143.49.181)
>>
>>
>> I leaned on the "(" key by accident, and it looks as if R
>> segfaults on a large
>> number (88 or more in my case) open brackets:
>>
>> Script started on Thu May 12 15:18:04 2005
>> $ R
>>
>> R : Copyright 2004, The R Foundation for Statistical Computing
>> Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0
>>
>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>> You are welcome to redistribute it under certain conditions.
>> Type 'license()' or 'licence()' for distribution details.
>>
>> R is a collaborative project with many contributors.
>> Type 'contributors()' for more information and
>> 'citation()' on how to cite R or R packages in publications.
>>
>> Type 'demo()' for some demos, 'help()' for on-line help, or
>> 'help.start()' for a HTML browser interface to help.
>> Type 'q()' to quit R.
>>
>>>
>> ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
>> ((((((((((((((((
>> (((((((((
>> + (
>> Segmentation fault
>> $ uname -a
>> Linux max 2.6.11-gentoo-r6 #2 Sat May 7 19:24:52 GMT 2005
>> i686 Intel(R)
>> Pentium(R) 4 CPU 2.40GHz GenuineIntel GNU/Linux
>> $ exit
>>
>> Script done on Thu May 12 15:18:16 2005
>>
>> Regards,
>>
>> Max
>>
>> R compiled with
>> gcc 3.3.5
>> glibc-2.3.4
>>
>> ______________________________________________
>> R-devel at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>>
>
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
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



More information about the R-devel mailing list