|
2004-08-16
| ||
| 21:18 | • Closed ticket [1008314fff]: Tcl_*SetVar* mishandle TCL_LIST_ELEMENT plus 7 o... artifact: b7dbe592de user: msofer | |
| 20:58 | • Ticket [1008314fff]: 4 changes artifact: f48551ab6e user: msofer | |
|
2004-08-14
| ||
| 22:20 | • Ticket [1008314fff]: 4 changes artifact: 8e9eccdf8f user: msofer | |
|
2004-08-13
| ||
| 21:21 | • Ticket [1008314fff]: 4 changes artifact: dc5b192776 user: dgp | |
| 21:21 | • Ticket [1008314fff]: 4 changes artifact: 77e0069c92 user: dgp | |
| 21:21 | • Add attachment 1008314.patch to ticket [1008314fff] artifact: fe62cb5aca user: dgp | |
| 06:57 | • Ticket [1008314fff] Tcl_*SetVar* mishandle TCL_LIST_ELEMENT status still Ope... artifact: 6b12ad3a18 user: dgp | |
| 06:12 | • Ticket [1008314fff]: 4 changes artifact: dd2862872b user: dgp | |
| 05:59 | • Ticket [1008314fff]: 4 changes artifact: 6c82172294 user: dgp | |
|
2004-08-12
| ||
| 22:26 | • New ticket [1008314fff]. artifact: 1113fa0536 user: dgp | |
Tcl_*SetVar* mishandle TCL_LIST_ELEMENT
Closed / Fixed1008314fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-08-12 22:26:31
The TclPtrSetVar() routine processes
the TCL_LIST_ELEMENT flag only
when the TCL_APPEND_VALUE
flag is also set. This is an error that
was introduced in revision 1.32 of
tclVar.c.
For example,
Tcl_SetVar(i, "x", "a b", TCL_LIST_ELEMENT);
will set the value of x to be "a b" and
not "{a b}" as it should according to the
docs.
The public routine Tcl_SetErrorCode() can
also be used to demo this bug. In particular
Tcl_SetErrorCode(i, "{", NULL);
will store a value in ::errorCode that is not
a valid Tcl list.
dgpplain2004-08-13 05:59:18
File Added - 97490: 1008314.patch Logged In: YES user_id=80530 The attached patch (against the HEAD) adds tests to the test suite that demo this bug.
dgpplain2004-08-13 06:12:18
Logged In: YES user_id=80530 Another possible error here is that when both TCL_LIST_ELEMENT and TCL_APPEND_VALUE are set, then the Tcl_ListObjAppendElement() routine is used to do the work. Use of T_LOAE adds the constraint that the value of the variable to which we are appending must already be a valid list.. I don't think that's a documented requirement of the Tcl_*SetVar* routines. On that point, a documentation fix is probably more attractive than a code change.
dgpplain2004-08-13 06:57:28
Logged In: YES user_id=80530 On the latter point, the T_LOAE routine has been in use for this operation since Tcl 8.0, it appears, so this change can safely be considered to be one of the Tcl 7 -> Tcl 8 incompatibilities. Only change that might be needed is improved documentation on the point.
dgpplain2004-08-13 21:21:23
Logged In: YES user_id=80530 New patch includes the fixes. Please review, test, apply, and backport.
dgpplain2004-08-13 21:21:24
File Deleted - 97490: File Added - 97590: 1008314.patch
msoferplain2004-08-14 22:20:56
Logged In: YES user_id=148712 I do not understand TclseterrorcodeCmd (in the patch) very well: it passes argv[5] to Tcl_SetErrorCode() even when (argc==3). Isn't this dangerous, as in setting up a possible segfault?
msoferplain2004-08-16 20:58:01
Logged In: YES user_id=148712 From the chat: dkf "Why are you worrying about testseterrorcode? It's a testing API; it's allowed to be unsafe" dgp "TclInvokeStringCommand passes an argv of minimum length 20, so testseterrorcode should be safe. ...and argv[argc] is guaranteed to be NULL."
msoferplain2004-08-16 21:18:53
Logged In: YES user_id=148712 Applied to HEAD and core-8-4-branch
Log in (anonymous is fine) to add a comment.
Attachments:
- 1008314.patch [download] added by dgp on 2004-08-13 21:21:23. [details]