Skip to content
Tcl Source Code History Of Ticket 218283ffffffffff
Login

History Of Ticket 218283ffffffffff

Artifacts Associated With Ticket 218283ffffffffff

  1. Ticket change [50c097acd2] (rid 126026) by nobody on 2000-10-26 00:55:29:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 3436 Bug
      Version: 8.2.1
      SubmitDate: '1999-11-05'
      LastModified: '1999-11-08'
      Severity: CRIT
      Status: Closed
      Submitter: techsupp
      ChangedBy: hobbs
      OS: Other
      FixedDate: '2000-10-25'
      ClosedDate: '1999-11-08'
      
      
      Name:
      George Petasis
      
      ReproducibleScript:
      Just compile the following code under windows with visual C++:
      
      #include <tcl.h>
      
      int AppInit(Tcl_Interp *interp);
      int Bug(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *objv[]);
      
      main (int argc, char *argv[]) {
        Tcl_Main(argc, argv, AppInit);
        return 0;
      }
      
      int AppInit(Tcl_Interp *interp) {
        if (Tcl_CreateObjCommand(interp, "bug", (Tcl_ObjCmdProc *)Bug, NULL, NULL) == NULL)
               return TCL_ERROR;
        return TCL_OK;
      }
      
      int Bug(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *objv[]) {
        Tcl_Obj *Obj, *List, **Elems;
        char tmp[256];
        int i,j,k;
      
        List = Tcl_NewListObj(0, NULL);
        if (List == NULL) return TCL_ERROR;
        Tcl_IncrRefCount(List);
      
        for (j=0; j<100; j++) {
          printf("->%d\n", j);
          for (i=0; i<10000; i++) {
            sprintf(tmp, "Obj-%d-%d", i, j);
            Obj = Tcl_NewStringObj(tmp, -1);
            if (Obj == NULL) return TCL_ERROR;
            if (Tcl_ListObjAppendElement(interp, List, Obj) != TCL_OK) 
                   return TCL_ERROR;
          }
      
          Obj = Tcl_NewStringObj(Tcl_GetString(List), -1); 
          Tcl_SetListObj(List, 0, NULL);
          Tcl_DecrRefCount(List); Tcl_IncrRefCount(Obj);
          Tcl_ListObjGetElements(interp, Obj, &k, &Elems);
          Tcl_IncrRefCount(Elems[10]); /* << that does the trick! */
          Tcl_SetListObj(Obj, 0, NULL);
          Tcl_DecrRefCount(Obj);
        }
        return TCL_OK;
      }
      
      run the executable and type "bug". 
      (Note that under windows 98 the system may become unstable
      and the user has to reboot the pc...)
      
      ObservedBehavior:
      This code cause an illegal instruction on both windows 98 SE and NT 4.0 SP5
      where it was tested. If the application is built as a console application, from
      the printf statement we get that it crashes at j=2. It seems that Tcl_SetListObj
      cannot handle properly list objects, some elements of which are shared.
      This problem is not reproducable under unix though, which is quite strange.
      But it might be related with the other bug report that I have submitted with title
      "[Bug Tcl 8.2.1] Possible Bug in internal memory management of the Tcl_Obj * structure".
      (also there was a small mistake in that report. In order for the bug to happen, 
      one must use the following script:
      
      for {set i 0} {$i < 10} {incr i} {
         foreach cmd [info commands] {
           lappend list $cmd
        }
      }
      Bug $list
      )
      
      
      
      This was due to incorrect use of objects, the fix was mentioned
      on the newsgroup. 
      -- 11/08/1999 hobbs
      
    4. foundin initialized to: "obsolete: 8.2.1"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "10. Objects"
    10. title initialized to:
      Tcl crashes after "emptying" a list object with Tcl_SetListO
      
    11. type initialized to: "Bug"
  2. Ticket change [cc5f99bdfe] (rid 95687) by welch on 2000-10-26 08:18:58:

    1. closedate changed to: "2000-10-26T01:18:58"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"