[Rd] segfault isoreg with NAs

Tobias Verbeke tobias.verbeke at telenet.be
Thu Dec 20 08:50:16 CET 2007


I was able to reproduce the problem under Windows (R 2.6.1).
When running ir4 <- isoreg(1:10, y4 <- c(5, 9, 1:2, 5:8, NA, 8)),
the following message appears:

"R for Windows GUI front-end has encountered a problem and
needs to close. We are sorry for the inconvenience"

after which R closes.

HTH,
Tobias

 > sessionInfo()
R version 2.6.1 (2007-11-26)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

> As can be seen below, adding a NA to the y values
> in a call to isoreg results in a segfault.
> 
> ir4 <- isoreg(1:10, y4 <- c(5, 9, 1:2, 5:8, NA, 8))
> 
> Adding missing values to the x values, on the contrary,
> gives an error, but maybe the error message could be
> tailored to this particular situation.
> 
> y <- c(5, 9, 1:2, 5:8, 3, 8)
> x <- c(1:9, NA)
> isoreg(x, y)
> ## error message: Error in if (!isOrd) { : missing value where 
> TRUE/FALSE needed
> 
> Please find below a (temporary) patch (against Revision 43692)
> for both the R source and the help file.
> 
> Kind regards,
> Tobias
> 
> ### patch isoreg.R ###
> 
> --- isoreg.R	2007-12-14 19:07:47.000000000 +0100
> +++ isoreg2.R	2007-12-14 19:11:20.000000000 +0100
> @@ -18,6 +18,9 @@
>   ##
>   isoreg <- function(x, y=NULL)
>   {
> +    if (any(is.na(x))) stop("x may not contain NA values")
> +    if (any(is.na(y))) stop("y may not contain NA values")
> +
>       xy <- xy.coords(x,y)
>       x <- xy$x
>       isOrd <- (!is.null(xy$xlab) && xy$xlab == "Index") || !is.unsorted(x)
> 
> ### patch isoreg.Rd ###
> 
> --- isoreg.Rd	2007-12-14 19:08:12.000000000 +0100
> +++ isoreg2.Rd	2007-12-14 19:15:00.000000000 +0100
> @@ -20,6 +20,7 @@
>     \item{x, y}{%in \code{isoreg},
>       coordinate vectors of the regression points.  Alternatively a single
>       plotting structure can be specified: see \code{\link{xy.coords}}.
> +    The coordinate vectors may not contain missing values.
>     }
>   }
>   \details{
> 
> 
> ### sessionInfo() information segfault ###
> 
>> sessionInfo()
> R version 2.6.0 (2007-10-03)
> i486-pc-linux-gnu
> 
> locale:
> LC_CTYPE=en_US.ISO-8859-15;LC_NUMERIC=C;LC_TIME=en_US.ISO-8859-15;LC_COLLATE=en_US.ISO-8859-15;LC_MONETARY=en_US.ISO-8859-15\
> ;LC_MESSAGES=en_US.ISO-8859-15;LC_PAPER=en_US.ISO-8859-15;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.ISO-885\
> 9-15;LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>> ir4 <- isoreg(1:10, y4 <- c(5, 9, 1:2, 5:8, NA, 8))
> 
>   *** caught segfault ***
> address 0x24, cause 'memory not mapped'
> 
> Process R segmentation fault (core dumped) at Fri Dec 14 17:48:22 2007
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
>



More information about the R-devel mailing list