Overview
| Artifact ID: | c1a0d1017bf3edf2877c87e8ac4d45ee91318ebf |
|---|---|
| Ticket: | 3598580fffffffffffffffffffffffffffffffff
Tcl_ListObjReplace may release deleted elements too early |
| User & Date: | dgp on 2012-12-29 12:57:33 |
Changes
- icomment:
Thank you for the demo to clarify matters. In the demo, the caller of T_LOR appears to be buggy in its management of refcounts. In the demo, the value "fgr" comes into the command procedure of [crash] with a refcount of 1, accounting for the reference that's stored in the list. After the call to Tcl_ListObjIndex() another reference to that value is stored in objP. To account for the second reference, at that point there should be a Tcl_IncrRefCount(objP); With that correct refcount management in place, there should be no issue left with the Tcl_ListObjReplace() that we've all been using a long time now. A balancing Tcl_DecrRefCount(objP) before returning from the [crash] command procedure would then account for that variable going out of scope. It's true that a buggy C caller can crash the program. That's been part of the power and responsibility of C callers as long as I've used Tcl. The Tcl C library fairly explicit does not attempt to armor plate itself against buggy C callers. Unless there's some other non-buggy demo of this issue, I'd say there's not a bug here in the sense of something that demands to be fixed. If that's correct, then I'd go on to say we ought not be messing with the 8.4 and 8.5 implementations over this. The improvement in additional safety against buggy C callers is something I'd consider in 8.6 patchlevels, but even there only when weighed against whatever negative impact might come along with the patch. Does it significantly impact performance in any reasonable scenarios? - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"