Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ed3536f254715aa5faa3f98110a0574d43b9f517
Ticket: 218317ffffffffffffffffffffffffffffffffff
Crash on SUN 64 bit platform (Sun5.7 Compiler- 5.0c++)
User & Date: nobody on 2000-10-26 00:56:03
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 3784 Bug
    Version: 8.2.2
    SubmitDate: '1999-12-06'
    LastModified: '2000-02-25'
    Severity: CRIT
    Status: Closed
    Submitter: techsupp
    ChangedBy: hobbs
    OS: SunOS
    FixedDate: '2000-10-25'
    ClosedDate: '2000-02-25'
    
    
    Name: Devendra Joshi
    
    CustomShell:
    if condition was added to check the nullity of cmdPtr before calling TclCleanupCommand and ckfree function.
    
    Comments:
    The if condition is desirable.
    
    ReproducibleScript:
    We are using tcl 8.2.2. We have created new Tcl commands to wrap our technology. A shared library is created for this purpose. By loading the library and using these commands we run some special jobs. It runs fine on Windows NT and SUN 32 bit platform (SUN 5.6 Compiler 4.2C++).
    
    We faced problem on SUN 64 bit platform (SUN 5.7 Compiler 5.0C++). In some commands the tcl script crashed. The crash occurrs at FreeCmdNameInternalRep() function in tclExecute.c file.
    
    ObservedBehavior:
    The crash occurs when TclCleanupCommand and ckfree processes NULL values.
    
    static void
    FreeCmdNameInternalRep(objPtr)
        register Tcl_Obj *objPtr;/* CmdName object with internal
     * representation to free. */
    {
        register ResolvedCmdName *resPtr =
    (ResolvedCmdName *) objPtr->internalRep.otherValuePtr;
    
        if (resPtr != NULL) {
    /*
     * Decrement the reference count of the ResolvedCmdName structure.
     * If there are no more uses, free the ResolvedCmdName structure.
     */
    
            resPtr->refCount--;
            if (resPtr->refCount == 0) {
                /*
         * Now free the cached command, unless it is still in its
                 * hash table or if there are other references to it
                 * from other cmdName objects.
         */
    
                Command *cmdPtr = resPtr->cmdPtr;
                TclCleanupCommand(cmdPtr); /* crashes when cmdPtr is NULL */
        ckfree((char *) resPtr); 
            }
        }
    }
    
    DesiredBehavior:
    This function should not cause crash.
    
    Patch:
    if condition was added to check the nullity of cmdPtr before calling TclCleanupCommand and ckfree function.
    
    After this modification the tcl code is working fine.
    
    static void
    FreeCmdNameInternalRep(objPtr)
        register Tcl_Obj *objPtr;/* CmdName object with internal
     * representation to free. */
    {
        register ResolvedCmdName *resPtr =
    (ResolvedCmdName *) objPtr->internalRep.otherValuePtr;
    
        if (resPtr != NULL) {
    /*
     * Decrement the reference count of the ResolvedCmdName structure.
     * If there are no more uses, free the ResolvedCmdName structure.
     */
    
            resPtr->refCount--;
            if (resPtr->refCount == 0) {
                /*
         * Now free the cached command, unless it is still in its
                 * hash table or if there are other references to it
                 * from other cmdName objects.
         */
    
                Command *cmdPtr = resPtr->cmdPtr;
        if (cmdPtr != NULL) { /* if added by us */
          TclCleanupCommand(cmdPtr);
          ckfree((char *) resPtr);
        }/* if ends */
            }
        }
    }
    
    PatchFiles:
    Submitted the code of function:
    
        static void
        FreeCmdNameInternalRep(objPtr)
            register Tcl_Obj *objPtr;/* CmdName object with internal
    
    
    
    Can't verify this without having the code that leads to it.
    A debugger dump would be most useful.  I have compiled Tcl
    on Sol7/64 with SunPro 5.0 and run the full tests suites
    without any errors.  While 64 bits problems could remain in
    the Tcl core, it is possible that the user has one in their
    own C extension. 
    -- 01/26/2000 hobbs
    
  4. foundin changed to: "obsolete: 8.2.2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "10. Objects"
  10. title changed to:
    Crash on SUN 64 bit platform (Sun5.7 Compiler- 5.0c++)
    
  11. type changed to: "Bug"