Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 0035ed70ec17dc30823891b147272751a66a68f6
Ticket: 3037525fffffffffffffffffffffffffffffffff
crash when freeing locals hashtable
User & Date: msofer on 2010-07-31 20:58:09
Changes

  1. icomment:
    Description of the early-freeing scenario:
      * two locals a and b defined at runtime - ie, in the hashtable and not the locals array
      * upvar 0 a b
      * the ONLY reference to a is by the upvar, and it remains undefined
      * the hashtable traversal reaches b before a
    
    In this case, when b is freed a is eliminated from the hashtable and is freed too: there are only two refcounts to this var, one from the hash entry and one from the upvar. When the upvar goes away, the undef'ed var is seen as being kept alive only by the entry, and the lot is freed to eliminate the "circular ref".
    
    Later, when Tcl_NextHashEntry tries to read a's entry we access freed memory.
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. username: "msofer"