gustafn
committed
on 20 Oct
- Fix a tricky Tcl_Obj sharing bug triggered by the usage of C-level
IndexObjs based on volatile tables. Consider the following example:
Show more
- Fix a tricky Tcl_Obj sharing bug triggered by the usage of C-level

 IndexObjs based on volatile tables. Consider the following example:

     proc foo {x} {

        return [bar -value x ...]

     }

  The Tcl_Obj "x" is shared as name of argument and as a value of the

  non-positional parameter "-value". When bar (e.g. C-implemented)

  uses Tcl_GetIndexFromObj*() to lookup "x" in a table of options,

  which is volatile, the involved Tcl_Obj will be converted to an

  indexObj.

  On a call with wrong number of arguments( e.g."foo 1 2 3"), Tcl

  will try to give a nice error message, saying that "foo x" can be

  called only with one argument. When printing argument "x", it sees

  that "x" is an indexObj, and for these kinds of objects, "x" might

  be an abbreviated version of a full name. Since the table behind

  the indexObj is in the case above volatile, a crash might happen.

  The committed fix above is just a temporary measure. NaviServer should

  try to avoid such Tcl_Obj conversions in these cases. It is also

  questionable, whether the attempt to interpret a argument name as

  an abbreviated.

Show less