Re: [Rd] Crashing R with readline()

From: Duncan Murdoch <murdoch.duncan_at_gmail.com>
Date: Thu, 29 Dec 2011 16:37:00 -0500

On 11-12-29 9:49 AM, Henrik Bengtsson wrote:
> I get the following with R v2.14.1 patched on Windows 7:
>
> % Rterm --vanilla --silent
>
>> sessionInfo()
> R version 2.14.1 Patched (2011-12-26 r58001)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
>> readline(sprintf("%-*s:", 180, "A prompt"))
> A prompt
>
> :
> [1] ""
>> q("no")
> Error: caught access violation - continue with care
>
> It is a consistent behavior.

I can reproduce this, but I can't spot where the problem is. I/O in Rterm is very complicated, because we use a getline library that implements line editing, and we run the I/O in a thread so that graphics windows can be updated while waiting for input.

Presumably the problem is the long prompt causing a buffer overflow somewhere, and a workaround is to use a more reasonable length of prompt, but I don't think I'm going to be able to offer a real fix. I'd guess this bug is local to Rterm in Windows, but we don't really have good tools there to detect buffer overflows.

Duncan Murdoch



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 29 Dec 2011 - 21:39:22 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 30 Dec 2011 - 11:00:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive