Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 02454db17413edf4129afb5c1089e205c6060075
Ticket: 3363369fffffffffffffffffffffffffffffffff
Tcl_SetObjResult can't handle NULL, despite documentation
User & Date: foomench on 2011-07-11 19:29:10
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Documentation for Tcl_SetObjResult states, "If objPtr is NULL, interp->objResult is set to a new Tcl object containing an empty string." However, the code doesn't do this. In fact, it tries to use objPtr in a Tcl_IncrRefCount call without checking for NULL, which results in an exception. Here's the code:
    
    void
    Tcl_SetObjResult(
        Tcl_Interp *interp,/* Interpreter with which to associate the
     * return object value. */
        register Tcl_Obj *objPtr)/* Tcl object to be returned. If NULL, the obj
     * result is made an empty string object. */
    {
        register Interp *iPtr = (Interp *) interp;
        register Tcl_Obj *oldObjResult = iPtr->objResultPtr;
    
        iPtr->objResultPtr = objPtr;
        Tcl_IncrRefCount(objPtr);/* since interp result is a reference */
    ...
    
  4. foundin changed to: "None"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "foomench"
  10. subsystem changed to: "10. Objects"
  11. title changed to:
    Tcl_SetObjResult can't handle NULL, despite documentation
    
  12. type changed to: "Bug"