Skip to content
Tcl Source Code History Of Ticket 3371644
Login

History Of Ticket 3371644

Artifacts Associated With Ticket 3371644

  1. Ticket change [bd40b25d40] (rid 101879) by thommey on 2011-07-19 17:54:37:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized 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 initialized to: "obsolete: 8.5.10"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "thommey"
    10. subsystem initialized to: "11. Conversions from String"
    11. title initialized to: "Segfault in Tcl_ConvertElement()"
    12. type initialized to: "Bug"
  2. Ticket change [695fc838fd] (rid 103237) by ferrieux on 2011-07-20 01:02:12:

    1. icomment:
      Also repro on 8.6 HEAD. There, line 1264 of tclUtil.c has a suspicious "length--" applied to a length of -1.
      
      Patch below fixes it and passes the test suite.
      
      Index: generic/tclUtil.c
      ===================================================================
      --- generic/tclUtil.c
      +++ generic/tclUtil.c
      @@ -1259,11 +1259,11 @@
              if (conversion == CONVERT_ESCAPE) {
                  p[0] = '\\';
                  p[1] = '#';
                  p += 2;
                  src++;
      -           length--;
      +           if (length >=0) length--;
              } else {
                  conversion = CONVERT_BRACE;
              }
           }
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  3. Ticket change [5a65d1a58b] (rid 118135) by ferrieux on 2011-07-20 01:23:01:

    1. icomment:
      Fixed in 8.6 HEAD. Leaving open until someone backcommits to 8.5 (properly :P)
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. resolution changed to: "Fixed"
    5. username: "ferrieux"
  4. Ticket change [2c5718db1d] (rid 118887) by dgp on 2011-07-20 02:40:48:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2011-07-19T19:40:48"
    3. closer changed to: "dgp"
    4. icomment:
      
      
      allow_comments - 1
      
      
      
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. status changed to: "Closed"
    8. username: "dgp"