Gu, Zuguang
2020-May-19 09:26 UTC
[Rd] Graphic parameters with length zero in grid cause R to crash
Hi, I found in grid package, if the graphic parameters have zero length, R crashes. In the following code, I only tested `grid.rect()` and the `fill` parameter, but I think it should be similar as other grid graphic functions. In `gpar()` function, the graphic parameters are not allowed to have zero length, but we can make them with zero length by first generating a `gpar` object and then subsetting with zero length index, such as follows: ```> library(grid) > gp = gpar(fill = 1) > grid.rect(gp = gp[integer(0)])``` After Executing the code, R crashes with message "Floating point exception: 8?". If I set the value of `fill` to an integer, the following code causes an error with a not informative error message.> library(grid) > gp = gpar(fill = as.integer(1)) > grid.rect(gp = gp[integer(0)])Error in grid.Call.graphics(C_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just, : numerical color values must be >= 0, found -192882464 But sometimes it also causes R to crash. My session info: ```> sessionInfo()R version 4.0.0 (2020-04-24) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Catalina 10.15.4 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] colorout_1.2-2 loaded via a namespace (and not attached): [1] compiler_4.0.0? ``` Best regards, Zuguang Gu? [[alternative HTML version deleted]]
Bob Rudis
2020-May-19 22:44 UTC
[Rd] Graphic parameters with length zero in grid cause R to crash
Reproduced on latest Catalina beta and R 4.0.0 and latest RStudio devel build (it crashes the session). On Tue, May 19, 2020 at 7:39 AM Gu, Zuguang <z.gu at dkfz-heidelberg.de> wrote:> > Hi, > > > I found in grid package, if the graphic parameters have zero length, R crashes. In the > > following code, I only tested `grid.rect()` and the `fill` parameter, but I think it should > > be similar as other grid graphic functions. > > > In `gpar()` function, the graphic parameters are not allowed to have zero length, but > we can make them with zero length by first generating a `gpar` object and then subsetting > with zero length index, such as follows: > > ``` > > library(grid) > > gp = gpar(fill = 1) > > grid.rect(gp = gp[integer(0)]) > ``` > > After Executing the code, R crashes with message "Floating point exception: 8?". > > If I set the value of `fill` to an integer, the following code causes an error with a > not informative error message. > > > library(grid) > > gp = gpar(fill = as.integer(1)) > > grid.rect(gp = gp[integer(0)]) > Error in grid.Call.graphics(C_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just, : > numerical color values must be >= 0, found -192882464 > > But sometimes it also causes R to crash. > > > My session info: > > > ``` > > > sessionInfo() > R version 4.0.0 (2020-04-24) > Platform: x86_64-apple-darwin17.0 (64-bit) > Running under: macOS Catalina 10.15.4 > > Matrix products: default > BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib > LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib > > locale: > [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] colorout_1.2-2 > > loaded via a namespace (and not attached): > [1] compiler_4.0.0? > ``` > > > Best regards, > Zuguang Gu? > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
Paul Murrell
2020-May-19 22:47 UTC
[Rd] Graphic parameters with length zero in grid cause R to crash
Yeah, that seems not good. I will take a look. Thanks for the report! Paul On 19/05/20 9:26 pm, Gu, Zuguang wrote:> Hi, > > > I found in grid package, if the graphic parameters have zero length, R crashes. In the > > following code, I only tested `grid.rect()` and the `fill` parameter, but I think it should > > be similar as other grid graphic functions. > > > In `gpar()` function, the graphic parameters are not allowed to have zero length, but > we can make them with zero length by first generating a `gpar` object and then subsetting > with zero length index, such as follows: > > ``` >> library(grid) >> gp = gpar(fill = 1) >> grid.rect(gp = gp[integer(0)]) > ``` > > After Executing the code, R crashes with message "Floating point exception: 8?". > > If I set the value of `fill` to an integer, the following code causes an error with a > not informative error message. > >> library(grid) >> gp = gpar(fill = as.integer(1)) >> grid.rect(gp = gp[integer(0)]) > Error in grid.Call.graphics(C_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just, : > numerical color values must be >= 0, found -192882464 > > But sometimes it also causes R to crash. > > > My session info: > > > ``` > >> sessionInfo() > R version 4.0.0 (2020-04-24) > Platform: x86_64-apple-darwin17.0 (64-bit) > Running under: macOS Catalina 10.15.4 > > Matrix products: default > BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib > LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib > > locale: > [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] colorout_1.2-2 > > loaded via a namespace (and not attached): > [1] compiler_4.0.0? > ``` > > > Best regards, > Zuguang Gu? > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
Maybe Matching Threads
- grid 4.0 generates wrong results when adding two complex units by sum()
- tcltk image reading problem (on a mac?): [tcl] encountered an unsupported criticial chunk type "eXIf"
- tcltk image reading problem (on a mac?): [tcl] encountered an unsupported criticial chunk type "eXIf"
- tcltk image reading problem (on a mac?): [tcl] encountered an unsupported criticial chunk type "eXIf"
- lines through points in lattice legend