Skip to content

text() with invalid argument type crashes RGui.exe

3 messages · Peter Ehlers, Brian Ripley, Roger Bivand

#
Dear Rexperts:

(R 2.0.1 on Windows XP Pro)

Is the following problem unique to my setup?
If it's a known problem, I didn't see it at
http://bugs.r-project.org/ nor find discussion in the archives.

plot(1:10)
loc <- c(5, 6)
text(loc, labels = "a")

Produces expected results according to ?xy.coords.

plot(1:10)
loc <- list(x = 5, y = 6)
text(loc, labels = "a")

No problem.

But:

plot(1:10)
loc <- list(5, 6)
text(loc, labels = "a")

crashes RGui.
("R for Windows GUI front-end has encountered a problem and ...")

R-FAQ:9.1 says:

If you call .C(), .Fortran(), .External() or .Call() (or
.Internal()) yourself (or in a function you wrote), you can
always crash R by using wrong argument types (modes). This
is not a bug.

I realize that I'm using the wrong argument type;
nevertheless, if the behaviour is general, it might be better
to generate an error.

For anyone with more know-how than I have, here are the details
of the crash:
AppName: rgui.exe     AppVer: 2.1.41115.0     ModName: r.dll
ModVer: 2.1.41115.0     Offset: 000ef1b3


Peter Ehlers
U of Calgary
ehlers@math.ucalgary.ca
#
It's general (on all platforms), and the internal code for text.default 
needs a safety check.
On Wed, 24 Nov 2004, P Ehlers wrote:

            

  
    
#
On Wed, 24 Nov 2004, P Ehlers wrote:

            
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0
RHEL 3 i386
Program received signal SIGFPE, Arithmetic exception.
0x080edd3b in do_text (call=0x9080c48, op=0x867d72c, args=0x8660570, 
    env=0x8a1bf90) at plot.c:2153
2153            xx = x[i % n];