Bug 16853 - diag(NULL, 1) makes R crash
Summary: diag(NULL, 1) makes R crash
Alias: None
Product: R
Classification: Unclassified
Component: Analyses (show other bugs)
Version: R 3.2.4
Hardware: x86_64/x64/amd64 (64-bit) Windows 64-bit
: P5 minor
Assignee: R-core
Depends on:
Reported: 2016-04-24 20:11 UTC by Said el Bouhaddani
Modified: 2016-04-24 21:36 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Said el Bouhaddani 2016-04-24 20:11:49 UTC
running diag(NULL, 1) makes R crash, without an error of warning. I don't know if it is windows specific though. This behavior was also present in 3.2.4.

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
major          3                           
minor          2.5                         
year           2016                        
month          04                          
day            14                          
svn rev        70478                       
language       R                           
version.string R version 3.2.5 (2016-04-14)
nickname       Very, Very Secure Dishes
Comment 1 Duncan Murdoch 2016-04-24 21:36:56 UTC
I can confirm this, and the fact that it's easy to fix.  The code used the LENGTH() macro without checking that it was applicable.  (You need to use the length() function on NULL to get zero.)

Have committed fix to R-devel; soon to the beta.