Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6db76f97b4dc98e55d92e0970785808d68067ce32046c404014919d9ec018ca0
Ticket: e533296a92d890449603ce54a5b1e2f04912e68a
SegFault on [info frame] on apply
User & Date: apnadkarni on 2026-08-27 03:31:55
Changes

  1. icomment:
    Sergey, I feel the fix proposed will solve this issue but there is a deeper, more serious problem as your question about procPtr implies. What I see is that the test script invokes `TclInfoFrame` (via `InfoFrameCmd`) three times. On the third invocation, debugger shows on entry to `TclInfoFrame`, the following values:
    
    ```
    CmdFrame *  framePtr 0x0000020cb5b10ef8
    CallFrame * framePtr->framePtr 0x0000020cb5b10db0
    Proc *      framePtr->framePtr->procPtr 0x0000020cb5ce4b08
    Command *   framePtr->framePtr->procPtr->cmdPtr 0x0000020cb5b110b0
    ```
    
    Note the last value in particular. Then the line [fptr = TclStackAlloc](https://core.tcl-lang.org/tcl/file?ci=9ec5286ed2fe765c&name=generic%2FtclCmdIL.c&ln=1299) returns 0x0000020cb5b110a0. Since sizeof(*fptr) is 88, this allocation overlaps the memory referenced by framePtr->framePtr->procPtr->cmdPtr. Consequently, this [line](https://core.tcl-lang.org/tcl/file?ci=9ec5286ed2fe765c&name=generic%2FtclExecute.c&ln=9762) overwrites `framePtr->framePtr->procPtr->cmdPtr->hPtr` causing the crash. But in the meanwhile plenty of other fields are also corrupted, this is merely the one hitting a crash first.
    
    It seems to me that some code path is releasing memory allocated by TclStackAlloc too early, resulting in that memory being overwritten while still in use. I don't understand the runtime frame management enough so you might be able to tell if that is the case and where it is happening much quicker than I could.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"