Overview
| Artifact ID: | 3fa66da561262093fb694c8a241552029a0df2d2cbdb3e664c475889cffc0ad2 |
|---|---|
| Ticket: | 4eb3a155ac6f73f48b270a19e543841d26bf2e6f
apply causes memory corruption / crash |
| User & Date: | sebres on 2022-07-27 15:29:13 |
Changes
- icomment:
As discussed in tclchat (IRC), the fix of Ashok covers only one case, as well as basically too heavy because would always reset the body of lambda, thus could unintentionally lost large internal representation of some object if body is evaluated as a list, e. g. basically it wouldn't be able anymore evaluate lambdas as pure-list (using Tcl_EvalObjv/TclNREvalObjv), because will always shimmer to string. Anyway, I could find the real reason of the issue and it looks much more grave as assumed - the procPtr object (of type tclProcBodyType) is stored (but not referenced) in its bytecode (in object of type tclByteCodeType), but if lambda/proc/whatever becomes free, codePtr->procPtr remains unchanged, although procPtr doesn't exists anymore, because released in TclProcCleanupProc. And since ByteCode would not be recompiled later, with that constellation I see dozen cases were it can segfault later, Ashok found only one case. I rebased the branch apn-apply-bug to 8.6 (where it is also pretty reproducible) and will provide a common solution for the issue (reset codePtr->procPtr in TclProcCleanupProc).
- login: "sebres"
- mimetype: "text/x-markdown"