Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b60d21ae82427c8cdca6dd746d54c0469ebe790c
Ticket: 1462248fffffffffffffffffffffffffffffffff
core dump on Linux while [read]ing file
User & Date: matzek on 2006-03-31 16:50:25
Changes

  1. assignee changed to: "vincentdarley"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Hi *,
    
    I occassionally get a core dump from a Sig11 on Linux
    (x86_64) while reading plain files. It seems to depend
    on the content of the file.
    
    The Tcl interpreter is built from unmodified sources
    and does not contain any extensions. It was built using
    gcc 4.0.2 with -m32 to get i386 compatible executables.
    
    % parray tcl_platform
    tcl_platform(byteOrder) = littleEndian
    tcl_platform(machine)   = x86_64
    tcl_platform(os)        = Linux
    tcl_platform(osVersion) = 2.6.13-15.7-smp
    tcl_platform(platform)  = unix
    tcl_platform(user)      = makr
    tcl_platform(wordSize)  = 4
    % set tcl_patchLevel
    8.4.12
    
    As I just noticed, it also only happens if env(LANG) is
    set to an UTF-8 encoding, e.g. de_DE.UTF-8 or en_US.UTF-8.
    
    Having a file like the attached "crashme" file, I'll do
    the following then ...
    
    % set f [open crashme]
    file3
    % while {![eof $f]} {read $f 4096}
    Segmentation fault (core dumped)
    
    Backtrace:
    
    #0  0x5561858c in memcpy () from /lib/tls/libc.so.6
    (gdb) bt
    #0  0x5561858c in memcpy () from /lib/tls/libc.so.6
    #1  0x080a973b in ReadChars (statePtr=0x810c338,
    objPtr=0x810cff0, charsToRead=74, offsetPtr=0xffffac18,
    factorPtr=0xffffac14)
        at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclIO.c:4818
    #2  0x080a91f3 in DoReadChars (chanPtr=0x8114510,
    objPtr=0x810cff0, toRead=74, appendFlag=0) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclIO.c:4488
    #3  0x080a90dd in Tcl_ReadChars (chan=0x8114510,
    objPtr=0x810cff0, toRead=4096, appendFlag=0) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclIO.c:4410
    #4  0x080aeaf6 in Tcl_ReadObjCmd (dummy=0x0,
    interp=0x80fc4f0, objc=3, objv=0x80ff78c) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclIOCmd.c:365
    #5  0x080629e9 in TclEvalObjvInternal
    (interp=0x80fc4f0, objc=3, objv=0x80ff78c, command=0x0,
    length=0, flags=0) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclBasic.c:3085
    #6  0x08090f25 in TclExecuteByteCode (interp=0x80fc4f0,
    codePtr=0x810c3b8) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclExecute.c:1419
    #7  0x08090106 in TclCompEvalObj (interp=0x80fc4f0,
    objPtr=0x8105e58) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclExecute.c:981
    #8  0x08063c7d in Tcl_EvalObjEx (interp=0x80fc4f0,
    objPtr=0x8105e58, flags=131072) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclBasic.c:4049
    #9  0x080a1f85 in Tcl_RecordAndEvalObj
    (interp=0x80fc4f0, cmdPtr=0x8105e58, flags=131072) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclHistory.c:142
    #10 0x0804ab09 in Tcl_Main (argc=-1, argv=0xffffb5c8,
    appInitProc=0x804a461 <Tcl_AppInit>) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclMain.c:392
    #11 0x0804a45a in main (argc=1, argv=0xffffb5c4) at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/tclAppInit.c:90
    (gdb) up
    #1  0x080a973b in ReadChars (statePtr=0x810c338,
    objPtr=0x810cff0, charsToRead=74, offsetPtr=0xffffac18,
    factorPtr=0xffffac14)
        at
    /home/makr/cvs/M214/ginfix2/openSrc/tcl8.4/unix/../generic/tclIO.c:4818
    4818            memcpy((VOID *) (nextPtr->buf +
    nextPtr->nextRemoved), (VOID *) src,
    
    I noticed that memcpy() got fed with srcLen=-22:
    
    (gdb) print srcLen
    $1 = -22
    (gdb) print src
    $2 = 0x812528e ""
    (gdb) print nextPtr->buf
    $3 = "\201�212\027"
    (gdb) print nextPtr->nextRemoved
    $4 = 38
    (gdb) print nextPtr->buf + nextPtr->nextRemoved
    $5 = 0x81252c6 ""
    
    I also just noticed ActiveTcl's tclsh8.4 (8.4.11) does
    also core dump...
    
    % parray ::activestate::ActiveTcl
    ::activestate::ActiveTcl(arch)          = linux-ix86
    ::activestate::ActiveTcl(as,mode)       = normal
    ::activestate::ActiveTcl(build)         = 162119
    ::activestate::ActiveTcl(buildtime,fmt) = Tue Jul 19
    10:40:31 AM PDT 2005
    ::activestate::ActiveTcl(buildtime,sec) = 1121794831
    ::activestate::ActiveTcl(maturity)      = final
    ::activestate::ActiveTcl(product)       = ActiveTcl
    ::activestate::ActiveTcl(release)       = 8.4.11.0
    %  set f [open crashme]
    file3
    % while {![eof $f]} {read $f 4096}
    Speicherzugriffsfehler (core dumped)
    
    Althouth this core does not give much away, it
    apparently crashes at the same position:
    
    #0  0x556c158c in memcpy () from /lib/tls/libc.so.6
    (gdb) bt
    #0  0x556c158c in memcpy () from /lib/tls/libc.so.6
    #1  0x555c535e in ReadChars () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #2  0x555c4fca in DoReadChars () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #3  0x555c4eb0 in Tcl_ReadChars () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #4  0x555c9582 in Tcl_ReadObjCmd () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #5  0x5558eb27 in TclEvalObjvInternal () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #6  0x555b2faa in TclExecuteByteCode () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #7  0x555b2475 in TclCompEvalObj () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #8  0x5558fbe7 in Tcl_EvalObjEx () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #9  0x555bf6f4 in Tcl_RecordAndEvalObj () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #10 0x555d3565 in Tcl_Main () from
    /usr/local/ActiveTcl/lib/libtcl8.4.so
    #11 0x080488aa in main ()
    
    kind regards -- Matthias Kraft
    
    PS: SF won't let me upload the file as it is 512 kB,
    please download from here:
    http://www.matkraft.de/files/crashme
    
    
  4. foundin changed to: "obsolete: 8.4.12"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "matzek"
  9. subsystem changed to: "37. File System"
  10. title changed to: "core dump on Linux while [read]ing file"
  11. type changed to: "Bug"