Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 49a2b9c02fd17945c6c100522c86ce34c59235da
Ticket: 1658572fffffffffffffffffffffffffffffffff
Heap corruption in interp.test
User & Date: twylite on 2007-03-16 19:57:58
Changes

  1. icomment:
    Logged In: YES 
    user_id=91629
    Originator: NO
    
    More feedback
    
    (1) BoundsChecker doesn't find any memory problems.  interp.test still crashes ... but no memory problems.
    
    (2) The script the crashed consistently yesterday ... well it refuses to crash today.  And I haven't touched the binary :(
    interp.test still crashes though.
    
    (3) The CallFrame is being overwritten by ... malloc().
    I ran tcltest.exe with interp.test, and noted the memory location of the corrupt CallFrame (containing the bad nsPtr value that is dereferenced causing the application to crash).
    Then I ran tcltest.exe with interp.test again in exactly the same manner, and put a watch on the memory location.  Leading up to the crash, the memory allocator happily allocates over the CallFrame as if it is free memory.
    
    Conclusion: It _is_ free memory.  Neither BoundsChecker nor the MSVCRT debug allocator see any problem with writing over the memory ... so I can only conclude that the CallFrame has been explicitly (and errneously) freed as some point.  
    ... of course I can't tell you what that point is ;(
    
    (4) But I can tell you where to look ;)
    
    A bunch of CVS carefully selected updates and a batch file tell me that -D 2006/10/23 runs fine, and -D 2006/10/24 crashes.
    
    The changelog for the latter date says the following:
    
    ---
    2006-10-23  Miguel Sofer  <[email protected]>
    
    * generic/tcl.h:           Modified the Tcl call stack so 
    * generic/tclBasic.c:      there is always a valid CallFrame, even 
    * generic/tclCmdIL.c:      at level 0 [Patch 1577278]. Most of the 
    * generic/tclInt.h:        changes involve removing tests for
    * generic/tclNamesp.c:     iPtr->(var)framePtr==NULL. There is now a
    * generic/tclObj.c:        CallFrame pushed at interp creation
    * generic/tclProc.c:       with a pointer to it stored in 
    * generic/tclTrace.c:      iPtr->rootFramePtr. A second unused
    * generic/tclVar.c:        field in Interp is hijacked to enable
    further functionality, currently unused (but with several FRQs
    depending on it).
    
    ***POTENTIAL INCOMPATIBILITY*** 
    Any user that includes tclInt.h and needs to determine if it is
    running at level 0 should change (iPtr->varFramePtr==NULL) to 
    (iPtr->varFramePtr==iPtr->rootFramePtr). 
    ---
    
    (5) It looks like this was the first change introduced after 8.5a5 :(  It has been present for nearly 5 months ... is no-one using bleeding-edge builds on Windows?!
    
    
    
    
  2. login: "twylite"
  3. mimetype: "text/plain"
  4. username: "twylite"