Skip to content
Tcl Source Code History Of Ticket 635200ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 635200ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 635200ffffffffffffffffffffffffffffffffff

  1. Ticket change [8887bbfcdc] (rid 131881) by vincentdarley on 2002-11-07 21:51:46:

    1. assignee initialized to: "nijtmans"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The following code:
      
          int len;
          Tcl_Obj *objPtr;
          objPtr = Tcl_NewObj();
          Tcl_AppendToObj(objPtr, "foobar\n", 7);
          Tcl_GetUnicodeFromObj(objPtr, &len);
          Tcl_AppendToObj(objPtr, "foobar\n", 7);
          Tcl_GetUnicodeFromObj(objPtr, &len);
          Tcl_SetObjLength(objPtr, 0);
          Tcl_AppendToObj(objPtr, "foobar\n", 7);
      
      results in a crash because objPtr->bytes == NULL and
      Tcl_AppendToObj tries to copy into it.  The crash
      occurs in AppendUtfToUtfRep here:
      
          memcpy((VOID *) (objPtr->bytes + oldLength), (VOID
      *) bytes,
          (size_t) numBytes);
      
      I don't know enough to be able to attempt to reproduce
      this in pure Tcl, but my implementation of tip113 ran
      into this problem...
      
      
    4. foundin initialized to: "obsolete: 8.4.1"
    5. priority initialized to: "7 High"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "vincentdarley"
    9. subsystem initialized to: "44. UTF-8 Strings"
    10. title initialized to: "crash in string object manipulation"
    11. type initialized to: "Bug"
  2. Ticket change [31dc6f5349] (rid 93509) by vincentdarley on 2002-11-08 05:11:29:

    1. assignee changed to: "hobbs"
  3. Ticket change [4021517562] (rid 121577) by vincentdarley on 2002-11-11 20:04:00:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      Also, if one replaces the last two calls with:
      
      Tcl_SetObjLength(objPtr, 0);
      Tcl_GetStringFromObj(objPtr, NULL);
      Tcl_AppendToObj(objPtr, "foobar\n", 7);
      Tcl_AppendToObj(objPtr, "foobar\n", 7);
      Tcl_AppendToObj(objPtr, "foobar\n", 7);
      Tcl_AppendToObj(objPtr, "foobar\n", 7);
      Tcl_AppendToObj(objPtr, "foobar\n", 7);
      
      then Tcl tramples all over memory.
      
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  4. Ticket change [1657bb5405] (rid 124706) by vincentdarley on 2002-11-12 05:10:19:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      Had a closer look at the code.  The basic problem is this:
      
      Objects with a Unicode internal representation can have
      their string representation invalidated (as when more
      Unicode bytes are appended to the object), so that
      'objPtr->bytes == NULL'.
      
      If, at that point, either Tcl_SetObjLength or
      Tcl_AttemptSetObjLength is called, the object is in a bad
      state. Neither of those functions knows what they are doing
      in that case (in fact, the first thing they do is invalidate
      the Unicode representation which is terribly wasteful!), and
      they end of placing the object in a state from which is
      cannot recover (both internal and string rep are gone)..
      
      I don't have enough expertise in this area to go much
      further, so I'd appreciate any help.
      
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  5. Ticket change [76d798c588] (rid 105654) by vincentdarley on 2002-11-14 05:12:30:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      See stringObj.test test number 14.1 for how to reproduce
      this using the tcl test suite.  The test is currently marked
      as knownBug.
      
      
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  6. Ticket change [0ff4628b63] (rid 94882) by vincentdarley on 2003-01-15 01:58:04:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      Upping priority to suggest this crash should be fixed for 
      8.4.2.  Here is a sample script:
      
          teststringobj set 1 foo
          teststringobj getunicode 1
          teststringobj append 1 bar -1
          teststringobj getunicode 1
          teststringobj append 1 bar -1
          teststringobj setlength 1 0
          teststringobj append 1 bar -1
          teststringobj get 1
      *crash*
      
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. priority changed to: "9 Immediate"
    5. username: "vincentdarley"
  7. Ticket change [846914100b] (rid 117552) by vincentdarley on 2003-01-17 18:29:35:

    1. closedate changed to: "2003-01-17T11:29:35"
    2. closer changed to: "vincentdarley"
    3. icomment:
      Logged In: YES 
      user_id=32170
      
      Studied the code a bit more closely, and the fix is actually
      quite simpe.  Tcl_SetObjLength is completely unaware of the
      fact that a Unicode StringObj may not have a valid
      objPtr->bytes, so by zeroing out the Unicode rep, that
      function has destroyed all available information about the
      object!
      
      Will commit a fix asap.
      
      
      
    4. login: "vincentdarley"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "vincentdarley"
  8. Ticket change [a434a83fdf] (rid 110175) by hobbs on 2003-01-21 01:10:59:

    1. assignee changed to: "andreas_kupries"
    2. icomment:
      Logged In: YES 
      user_id=72656
      
      Fix invalid.  Still needs analysis.
      
      
    3. login: "hobbs"
    4. mimetype: "text/plain"
    5. status changed to: "Open"
    6. username: "hobbs"
  9. Ticket change [7335f27482] (rid 105002) by andreas_kupries on 2003-01-21 01:13:38:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      See also Tcl Bug 671138.
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  10. Ticket change [00ec7e3400] (rid 119393) by vincentdarley on 2003-01-24 19:05:14:

    1. assignee changed to: "das"
    2. icomment:
      Logged In: YES 
      user_id=32170
      
      Fixed the bug properly, using Daniel's patch, plus 
      appropriate modifications to Tcl_AttemptSetObjLength. 
      Assigning to Daniel for his efficiency improvements, as 
      discussed in email.
      
      Changed bug title and priority accordingly.
      
      
      
      
    3. login: "vincentdarley"
    4. mimetype: "text/plain"
    5. priority changed to: "7 High"
    6. title changed to: "string obj unicode efficiency"
    7. username: "vincentdarley"
  11. Ticket change [92b989d3ac] (rid 120822) by das on 2003-02-18 18:51:12:

    1. closedate changed to: "2003-02-18T11:51:12"
    2. closer changed to: "das"
    3. icomment:
      Logged In: YES 
      user_id=90580
      
      c.f. bug 686782: attached tclStringObj.c patch and associated 
      discussion
      
      
    4. login: "das"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "das"