Skip to content

data.entry segfault

4 messages · Arne Henningsen, Peter Dalgaard, (Ted Harding)

#
Hi,
there is a similar problem with R Version 1.6.1 on SuSE-Linux 8.0:
R crashes and I get "Speicherzugriffsfehler" (=~ Memory Access Error) from the 
console. I think R tries to write something to somewhere where it has no 
write access. I hope that this could help others to find a solution.
Arne.
On Thu, 12 Dec 2002 17:14:19, Ted.Harding at nessie.mcc.ac.uk wrote:

  
    
#
Arne Henningsen <ahenningsen at email.uni-kiel.de> writes:
I get this (with 1.6.0 installed from the CRAN RPM) SuSE too, but *not* on
RedHat. More detailed symptoms are 

Breakpoint 2, doSpreadKey (key=0, event=0xbfffe0e4) at dataentry.c:1172
1172    in dataentry.c
(gdb) s
GetKey (event=0xbfffe0e4) at dataentry.c:1248
1248    in dataentry.c
(gdb)
1249    in dataentry.c
(gdb)
1250    in dataentry.c
(gdb)
doSpreadKey (key=68, event=0x12) at dataentry.c:1173
1173    in dataentry.c
(gdb)
GetCharP (event=0x12) at dataentry.c:1257
1257    in dataentry.c
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x40290087 in XLookupString () from /usr/X11R6/lib/libX11.so.6
(gdb) bt
#0  0x40290087 in XLookupString () from /usr/X11R6/lib/libX11.so.6
#1  0x4021475b in GetCharP (event=0x12) at dataentry.c:1257
#2  0x402143b3 in doSpreadKey (key=68, event=0x12) at dataentry.c:1173
(gdb)

so it would seem like something in the GetKey call is destroying the
stack. 

It is reproducible with a hand-compiled version and things boil down
to

1243    static KeySym GetKey(DEEvent * event)
1244    {
1245        char text[1];
1246        KeySym iokey;
1247
1248        XLookupString(event, text, 10, &iokey, 0);
1249        return iokey;
1250    }

And the XLookupString call is the culprit. "10" is the buffer length,
but "text" is declared to have length 1, and in practice has at least 2
bytes since "text" is \0-terminated...

Switching to "char text[10];" looks like a likely fix.

        -p
#
Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:
Actually, replacing 10 with 1 also works.
#
On 13-Dec-02 Peter Dalgaard BSA wrote:
Interesting. But why does it give a problem in SuSE (both RPM and
hand-compiled) but not on RedHat? (I too have R also on Red Hat 7.2,
was R-1.2, is now R-1.6.1, and have not had this problem with either
version of R; R-1.4 on SuSE 7.2 however segfaults). Presumably the
same code is compiled on both distributions ... ?

Best wishes,
Ted.




--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 13-Dec-02                                       Time: 17:29:34
------------------------------ XFMail ------------------------------