[Rd] unstability when using isoreg() function (PR#6494)

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Jan 29 12:16:01 MET 2004


iKnots was allocated one element too short.  This only overruns if the 
sequence is monotone, as happens here for set.seed(2), N=3.  Fixed in 
R-devel.

The line 39 in isoreg.c needs to be

    SET_VECTOR_ELT(ans, 3, iKnots= allocVector(INTSXP, n));


Duncan was trying to give a reproducible example, Petr, as we do ask you 
to do in the FAQ.

On Thu, 29 Jan 2004 dmurdoch at pair.com wrote:

> On Wed, 28 Jan 2004 17:31:27 +0100 (CET), you wrote:
> 
> >Full_Name: Petr Klasterecky
> >Version: 1.8.1
> >OS: Windows XP, Linux
> >Submission from: (NULL) (195.113.27.212)
> >
> >
> >The isoreg() function causes R to crash when called repeatedly. Consider the
> >following simple script:
> >
> >{
> >library(modreg)
> >N <- 10
> >x <- rnorm(N)
> >print("Original x values:")
> >print(x)
> >for(n in (1:N)){print(y <- isoreg(x[1:n])$yf)}
> >} 
> 
> I get the crash reproducibly in r-devel after I put "set.seed(2)"
> ahead of the sample code above.  (Of course, r-devel doesn't need the
> library(modreg), but that doesn't affect the bug.)  Other seeds and
> the code works without error.
> 
> I tried tracing into R_isoreg to try to spot the problem, but the
> error occurs after it returns.  It has all the symptoms of some code
> writing outside allocated bounds, but I couldn't see where that
> happened.
> 
> Duncan Murdoch
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.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