Tcl_SetObjResult can't handle NULL, despite documentation
Closed / Duplicate3363369fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2011-07-11 19:29:10
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 */
...
msoferplain2011-07-12 19:34:33
allow_comments - 1 dup of 3363556 (submitted twice)
Log in (anonymous is fine) to add a comment.