Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 010485b713e12d100533c49cf9ccf1194f653c45
Ticket: 2494093fffffffffffffffffffffffffffffffff
buffer overflow in AppendUnicodeToUnicode() -> SEGFAULT
User & Date: matzek on 2009-01-09 17:45:27
Changes

  1. icomment:
    ok, looked into 8.5 again: it now seems to be some kind of integer overflow, or something in this direction.
    
    My Linux build is 64 bit, that means sizeof(size_t) is 8, while sizeof(int) is 4.
    
    The core dump now shows:
    
    - the memcpy() call in AppendUnicodeToUnicodeep() crashes again:
      #0  0x00007febad876dd3 in memcpy () from /lib64/libc.so.6
      #1  0x00007febae0a82d1 in AppendUnicodeToUnicodeRep (objPtr=0x625990, unicode=0x63bafc, appendNumChars=4096)
          at /home/makr/cvs/tccvs/tcl-8.5/unix/../generic/tclStringObj.c:1336
    
    - the other values are:
      (gdb) print *stringPtr
      $2 = {numChars = 1073737728, allocated = 16384, uallocated = 4294967296, hasUnicode = 1, unicode = {222, 173}}
      (gdb) print numChars
      $3 = 1073741824
    
    - $3 == 1<<30 == 1GB
    
    - (gdb) print numChars - stringPtr->numChars
      $6 = 4096
    
    - stringPtr->uallocated == 1<<32 == 4GB which means the attemptckrealloc() has not failed
    
    so far my observations, maybe I have time to come back to it later today ...
    
    
  2. login: "matzek"
  3. mimetype: "text/plain"
  4. username: "matzek"