Re: R-alpha: paste(list(character(0),""), 1:2) ##--> Segmentation fault

Peter Dalgaard BSA (p.dalgaard@kubism.ku.dk)
26 Feb 1997 19:09:34 +0100


To: Martin Maechler <maechler@stat.math.ethz.ch>
Subject: Re: R-alpha: paste(list(character(0),""), 1:2)   ##--> Segmentation fault
From: Peter Dalgaard BSA <p.dalgaard@kubism.ku.dk>
Date: 26 Feb 1997 19:09:34 +0100
In-Reply-To: Martin Maechler's message of Wed, 26 Feb 97 18:41:11 +0100
Message-Id: <x2lo8bsald.fsf@bush.kubism.ku.dk>

Martin Maechler <maechler@stat.math.ethz.ch> writes:

> 
> (all said)

Not quite Martin:

$ gdb  R/bin/R.binary  core
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i586-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
Core was generated by `/home/sfe/pd/R/bin/R.binary'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/X11R6/lib/libSM.so.6.0...done.
Reading symbols from /usr/X11R6/lib/libICE.so.6.0...done.
Reading symbols from /usr/X11R6/lib/libX11.so.6.1...done.
Reading symbols from /usr/lib/libf2c.so.0.20...done.
Reading symbols from /lib/libdl.so.1.7.14...done.
Reading symbols from /usr/lib/libreadline.so.2.0...done.
Reading symbols from /lib/libtermcap.so.2.0.8...done.
Reading symbols from /lib/libm.so.5.0.6...done.
Reading symbols from /lib/libc.so.5.4.7...done.
Reading symbols from /lib/ld-linux.so.1...done.
#0  0x8019e30 in coerceList (v=0x40588ad0, type=15) at coerce.c:436
436                                     STRING(rval)[i] = STRING(CAR(v))[0];

#0  0x8019e30 in coerceList (v=0x40588ad0, type=15) at coerce.c:436
#1  0x8019bcd in coerceVector (v=0x40588ad0, type=15) at coerce.c:386
#2  0x8018c5b in do_as (call=0x401d1400, op=0x401c23b0, args=0x40588b20, 
    rho=0x40588b98) at coerce.c:105
#3  0x8046247 in do_internal (call=0x401d1464, op=0x401bec74, args=0x40588b20, 
    env=0x40588b98) at names.c:693
#4  0x803491a in eval (e=0x401d1464, rho=0x40588b98) at eval.c:136
#5  0x8034f0d in applyClosure (call=0x402c95c4, op=0x401d14f0, 
    arglist=0x40588bc0, rho=0x40588ecc, suppliedenv=0x401be008) at eval.c:238
#6  0x8034c35 in eval (e=0x402c95c4, rho=0x40588ecc) at eval.c:156
#7  0x8035fe2 in applydefine (call=0x402c9600, op=0x401be828, args=0x402c95ec, 
    rho=0x40588ecc) at eval.c:590
#8  0x80364c4 in do_set (call=0x402c9600, op=0x401be828, args=0x402c95ec, 
    rho=0x40588ecc) at eval.c:657
#9  0x803491a in eval (e=0x402c9600, rho=0x40588ecc) at eval.c:136
#10 0x8035875 in do_for (call=0x402c9650, op=0x401be558, args=0x402c963c, 
    rho=0x40588ecc) at eval.c:417
#11 0x803491a in eval (e=0x402c9650, rho=0x40588ecc) at eval.c:136
#12 0x8035e41 in do_begin (call=0x402c9664, op=0x401be8c8, args=0x402c9678, 
    rho=0x40588ecc) at eval.c:539
#13 0x803491a in eval (e=0x402c9664, rho=0x40588ecc) at eval.c:136
#14 0x8035449 in do_if (call=0x402c981c, op=0x401be4b8, args=0x402c9808, 
    rho=0x40588ecc) at eval.c:353
---Type <return> to continue, or q <return> to quit---
#15 0x803491a in eval (e=0x402c981c, rho=0x40588ecc) at eval.c:136
#16 0x8035e41 in do_begin (call=0x402c92f4, op=0x401be8c8, args=0x402c9830, 
    rho=0x40588ecc) at eval.c:539
#17 0x803491a in eval (e=0x402c92f4, rho=0x40588ecc) at eval.c:136
#18 0x8034f0d in applyClosure (call=0x40588fa8, op=0x402c98bc, 
    arglist=0x40588f6c, rho=0x401c51b4, suppliedenv=0x401be008) at eval.c:238
#19 0x8034c35 in eval (e=0x40588fa8, rho=0x401c51b4) at eval.c:156
#20 0x803c918 in R_Repl (rho=0x401c51b4, savestack=0, browselevel=0)
    at main.c:192
#21 0x803cd29 in mainloop () at main.c:364
#22 0x8092abd in main (ac=0, av=0xbffff97c) at system.c:266
#23 0x8009b0b in ___crt_dummy__ ()
(gdb) print i
$1 = 0
(gdb) print rval
$2 = (SEXPREC *) 0x40588a94
(gdb) print *rval
$3 = {sxpinfo = {type = 15, obj = 0, named = 0, gp = 0, mark = 0, debug = 0, 
    trace = 0,  = 0}, attrib = 0x401be008, u = {vecsxp = {length = 2, type = {
        c = 0x405ae168 "\b\e@\b\e@A2@", i = 0x405ae168, f = 0x405ae168, 
        z = 0x405ae168, s = 0x405ae168}}, primsxp = {offset = 2}, symsxp = {
      pname = 0x2, value = 0x405ae168, internal = 0x401be008}, listsxp = {
      carval = 0x2, cdrval = 0x405ae168, tagval = 0x401be008}, envsxp = {
      frame = 0x2, enclos = 0x405ae168}, closxp = {formals = 0x2, 
      body = 0x405ae168, env = 0x401be008}, promsxp = {value = 0x2, 
      expr = 0x405ae168, env = 0x401be008}}}
(gdb) print v
$6 = (SEXPREC *) 0x40588ad0
(gdb) print *v
$7 = {sxpinfo = {type = 2, obj = 0, named = 0, gp = 0, mark = 0, debug = 0, 
    trace = 0,  = 0}, attrib = 0x401be008, u = {vecsxp = {length = 1079544548, 
      type = {c = 0x40588aa8 "\002", i = 0x40588aa8, f = 0x40588aa8, 
        z = 0x40588aa8, s = 0x40588aa8}}, primsxp = {offset = 1079544548}, 
    symsxp = {pname = 0x40588ae4, value = 0x40588aa8, internal = 0x401be008}, 
    listsxp = {carval = 0x40588ae4, cdrval = 0x40588aa8, tagval = 0x401be008}, 
    envsxp = {frame = 0x40588ae4, enclos = 0x40588aa8}, closxp = {
      formals = 0x40588ae4, body = 0x40588aa8, env = 0x401be008}, promsxp = {
      value = 0x40588ae4, expr = 0x40588aa8, env = 0x401be008}}}
(gdb) print *(v->u.listsxp.carval)
$8 = {sxpinfo = {type = 15, obj = 0, named = 0, gp = 0, mark = 0, debug = 0, 
    trace = 0,  = 0}, attrib = 0x401be008, u = {vecsxp = {length = 0, type = {
        c = 0x0, i = 0x0, f = 0x0, z = 0x0, s = 0x0}}, primsxp = {offset = 0}, 
    symsxp = {pname = 0x0, value = 0x0, internal = 0x401be008}, listsxp = {
      carval = 0x0, cdrval = 0x0, tagval = 0x401be008}, envsxp = {frame = 0x0, 
      enclos = 0x0}, closxp = {formals = 0x0, body = 0x0, env = 0x401be008}, 
    promsxp = {value = 0x0, expr = 0x0, env = 0x401be008}}}

AHA: NULL pointer dereference in STRING(CAR(v))[0]

This string is NULL, not merely empty.

Now I think I said enough for now...


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-