Bug 14766 - readLines(f) crashes R on Linux when f has exactly 1000 bytes with no EOL marker
readLines(f) crashes R on Linux when f has exactly 1000 bytes with no EOL marker
Status: RESOLVED FIXED
Product: R
Classification: Unclassified
Component: I/O
R 2.14.1
x86_64/x64/amd64 (64-bit) Linux
: P5 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-30 01:48 UTC by Hsiu-Khuern Tang
Modified: 2011-12-30 03:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hsiu-Khuern Tang 2011-12-30 01:48:42 UTC
Here's an R session showing how to trigger this (tried on Debian sid and RHEL4):

> cat(paste(rep("a", 1000), collapse = ""), file = "a.txt")
> readLines("a.txt")
*** glibc detected *** /usr/lib/R/bin/exec/R: double free or corruption (!prev): 0x00000000017dc1a0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x72606)[0x7f1a2a2e5606]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f1a2a2ea33c]
/usr/lib/R/lib/libR.so(+0x8e730)[0x7f1a2aaae730]
/usr/lib/R/lib/libR.so(+0xe8ed1)[0x7f1a2ab08ed1]
/usr/lib/R/lib/libR.so(Rf_eval+0x17a)[0x7f1a2ab1443a]
/usr/lib/R/lib/libR.so(Rf_applyClosure+0x32f)[0x7f1a2ab17abf]
/usr/lib/R/lib/libR.so(Rf_eval+0x400)[0x7f1a2ab146c0]
/usr/lib/R/lib/libR.so(Rf_ReplIteration+0x1e3)[0x7f1a2ab50923]
/usr/lib/R/lib/libR.so(+0x130ba0)[0x7f1a2ab50ba0]
/usr/lib/R/lib/libR.so(run_Rmainloop+0x50)[0x7f1a2ab50c10]
/usr/lib/R/bin/exec/R(main+0x1b)[0x40086b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f1a2a291ead]
/usr/lib/R/bin/exec/R[0x40089d]
======= Memory map: ========
(lines deleted)

> version
               _                            
platform       x86_64-pc-linux-gnu          
arch           x86_64                       
os             linux-gnu                    
system         x86_64, linux-gnu            
status                                      
major          2                            
minor          14.1                         
year           2011                         
month          12                           
day            22                           
svn rev        57956                        
language       R                            
version.string R version 2.14.1 (2011-12-22)



Thanks,
- Hsiu-Khuern Tang
Comment 1 Duncan Murdoch 2011-12-30 03:46:53 UTC
Fixed in R-devel and soon R-patched.
Comment 2 Duncan Murdoch 2011-12-30 07:21:53 UTC
This also happens in R-devel in Windows (using Rterm).  I'll track it 
down...