pdenis2@home.com
2001-Feb-16 04:35 UTC
[Rd] print.matrix segfaults if rowlab vector too short (PR#850)
print.matrix(x) segfaults if the vector supplied to 'rowlab' is *shorter* than nrow(x):> version_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 1 minor 2.1 year 2001 month 01 day 15 language R [installed from RPM]> x<-1:4 > dim(x)<-c(2,2) > x[,1] [,2] [1,] 1 3 [2,] 2 4> print.matrix(x)[,1] [,2] [1,] 1 3 [2,] 2 4> print.matrix(x,rowlab=c('a','b'))[,1] [,2] a 1 3 b 2 4> print.matrix(x,rowlab=c('a','b','c'))[,1] [,2] a 1 3 b 2 4 [OK, ignores extra labels ...]> print.matrix(x,rowlab=c('a'))Segmentation fault (core dumped) Similar behavior for 'collab' ... -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thomas Lumley
2001-Feb-16 16:50 UTC
[Rd] print.matrix segfaults if rowlab vector too short (PR#850)
On Fri, 16 Feb 2001 pdenis2@home.com wrote:> print.matrix(x) segfaults if the vector supplied to 'rowlab' is > *shorter* than nrow(x): >Ok, the cause is the obvious one: there is no check for the length of rowlab in print[type]Matrix, nor in formatString. formatString happily wanders along the vector and falls off the end. I'm going to fix it in formatString, we may also want to fix it higher up. -thomas> > version > _ > platform i686-pc-linux-gnu > arch i686 > os linux-gnu > system i686, linux-gnu > status > major 1 > minor 2.1 > year 2001 > month 01 > day 15 > language R > [installed from RPM] > > > x<-1:4 > > dim(x)<-c(2,2) > > x > [,1] [,2] > [1,] 1 3 > [2,] 2 4 > > print.matrix(x) > [,1] [,2] > [1,] 1 3 > [2,] 2 4 > > print.matrix(x,rowlab=c('a','b')) > [,1] [,2] > a 1 3 > b 2 4 > > print.matrix(x,rowlab=c('a','b','c')) > [,1] [,2] > a 1 3 > b 2 4 [OK, ignores > extra labels ...] > > print.matrix(x,rowlab=c('a')) > Segmentation fault (core dumped) > > Similar behavior for 'collab' ... > > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >Thomas Lumley Asst. Professor, Biostatistics tlumley@u.washington.edu University of Washington, Seattle ^^^^^^^^^^^^^^^^^^^^^^^^ NOTE NEW EMAIL ADDRESS -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
tlumley@u.washington.edu
2001-Feb-16 16:54 UTC
[Rd] print.matrix segfaults if rowlab vector too short (PR#850)
On Fri, 16 Feb 2001, Thomas Lumley wrote:> On Fri, 16 Feb 2001 pdenis2@home.com wrote: > > > print.matrix(x) segfaults if the vector supplied to 'rowlab' is > > *shorter* than nrow(x): > > > > Ok, the cause is the obvious one: there is no check for the length of > rowlab in print[type]Matrix, nor in formatString. formatString happily > wanders along the vector and falls off the end. > > I'm going to fix it in formatString, we may also want to fix it higher up.No I'm not: formatString gets a C vector of strings, not an R vector. It has to be fixed higher up. -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._