Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: bd40b25d40bdbcfddab8c357b5c4d49e1710ab1e
Ticket: 3371644fffffffffffffffffffffffffffffffff
Segfault in Tcl_ConvertElement()
User & Date: thommey on 2011-07-19 17:54:37
Changes

  1. assignee changed to: "hobbs"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The testcode at http://paste.tclers.tk/2502 causes tcl8.5.10 (release) and current head to segfault (dereferences garbage pointer).
    
    gdb output:
    
    Program received signal SIGSEGV, Segmentation fault.
    0xb7f6e493 in TclConvertElement (
        src=0x8074d0d "O\270\267xO\270\267\200O\270\267`O\270\267", length=-2, 
        dst=0x805fa60 "\\#test\\\\\\\\\\\\", flags=4)
        at /xtra/src/tcl8.5.10/unix/../generic/tclUtil.c:1363
    1363*p = *src;
    (gdb) p p
    $1 = 0x808d000 <Address 0x808d000 out of bounds>
    (gdb) bt full
    #0  0xb7f6e493 in TclConvertElement (
        src=0x8074d0d "O\270\267xO\270\267\200O\270\267`O\270\267", length=-2, 
        dst=0x805fa60 "\\#test\\\\\\\\\\\\", flags=4)
        at /usr/src/tcl8.5.10/unix/../generic/tclUtil.c:1363
            conversion = 4
            p = 0x808d000 <Address 0x808d000 out of bounds>
    #1  0xb7f6e24a in Tcl_ConvertCountedElement (
        src=0x808d000 <Address 0x808d000 out of bounds>, length=-1, 
        dst=0x805fa60 "\\#test\\\\\\\\\\\\", flags=4)
        at /usr/src/tcl8.5.10/unix/../generic/tclUtil.c:1202
            numBytes = -1208557020
    #2  0xb7f6e21e in Tcl_ConvertElement (
        src=0x8074d0d "O\270\267xO\270\267\200O\270\267`O\270\267", 
        dst=0x808d000 <Address 0x808d000 out of bounds>, flags=79)
        at /usr/src/tcl8.5.10/unix/../generic/tclUtil.c:1171
    No locals.
    #3  0x080487f8 in main (argc=1, argv=0xbffffa14) at test2.c:20
            flags = 4
            size = 12
            dst = 0x805fa60 "\\#test\\\\\\\\\\\\"
            src = 0x8048900 "#test\\\\\\"
            interp = 0x804c9e0
    
    Valgrind:
    
    ==6136== Invalid write of size 1
    ==6136==    at 0x4137493: TclConvertElement (tclUtil.c:1363)
    ==6136==    by 0x4137249: Tcl_ConvertCountedElement (tclUtil.c:1202)
    ==6136==    by 0x413721D: Tcl_ConvertElement (tclUtil.c:1171)
    ==6136==    by 0x80487F7: main (test2.c:20)
    ==6136==  Address 0x437e16d is 0 bytes after a block of size 13 alloc'd
    ==6136==    at 0x4025018: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
    ==6136==    by 0x80487C2: main (test2.c:18)
    
    
  4. foundin changed to: "obsolete: 8.5.10"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "thommey"
  10. subsystem changed to: "11. Conversions from String"
  11. title changed to: "Segfault in Tcl_ConvertElement()"
  12. type changed to: "Bug"