[Rd] segfault / crash when asking for large memory via strrep()

2016-06-01 Thread Martin Maechler
We've had this more general topic on R-help, and also in R-devel recently. There's one case here where I get the feeling R never gets into swapping but more directly aborts possibly from a bug we can more easily fix. Today I've been working (successfully! - not yet committed) at fixing str() for

Re: [Rd] segfault / crash when asking for large memory via strrep()

2016-06-01 Thread luke-tierney
That would be because the product nc * ni overflows in cbuf = buf = CallocCharBuf(nc * ni); Since we disallow strings with more than 2^31-1 bytes we could test and reject this. It might be more future-proof to change the declaration of int j, ni, nc; to R_xlen_t j, ni, nc; and le

Re: [Rd] segfault / crash when asking for large memory via strrep()

2016-06-01 Thread luke-tierney
I've added a size/overflow check before the buffer allocation in R-devel and R-patched. It would be a good idea sometime to review the use of calloc ... free patterns to make sure the ... can't raise an error or otherwise jump and leave the memory pointer dangling. Best, luke On Wed, 1 Jun 2

[Rd] [RfC] Family dispersion

2016-06-01 Thread Luis Carvalho
Hi, I'd like to hear your opinion about the following proposal to make the computation of dispersion in GLMs more flexible. Dispersion is used in summary.glm; the relevant code chunk with the dispersion calculation is listed below (from glm.R): summary.glm <- function(object, dispersion = NULL,