Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 18868b2f614c07f927dd87a4c792a2c59215f14c
Ticket: 3564735fffffffffffffffffffffffffffffffff
Tcl8.5 + incrTcl3.4 [variable] crash
User & Date: bgriffin on 2012-09-04 15:38:00
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    I've recently tracked down a crash that was due to faulty coding in an incrTcl methods, however, I don't know if this is a known "problem" with incrTcl, or a bug in the 8.5.8+34 combination, or just the way things are.  I'm also wondering if there shouldn't be a runtime check for this condition.
    
    So what is the problem?
    
    itcl::class Dog {
    variable bite
    method bark {}
    }
    
    itcl::body Dog::bark {} {
    variable bite
    set bite false
    puts "Bark!"
    }
    
    The crash is due to the unnecessary "variable" statement in the itcl::body.  It ends up corrupting the heap. (Thanks for TCL_MEM_DEBUG!)  
    
    $ tclsh8.5
    % package require Itcl
    3.4
    % memory validate on
    % itcl::class Dog {
            variable bite
            method bark {}
    }
    % itcl::body Dog::bark {} {
            variable bite
            set bite false
            puts "Bark!"
    }
    % Dog fido
    fido
    % fido bark
    hi guard byte 0 is 0x62         b
    total mallocs                 114496
    total frees                   103026
    current packets allocated      11470
    current bytes allocated       482362
    maximum packets allocated      15640
    maximum bytes allocated       630832
    high guard failed at 81ba7f8, .../tcl/unix/../generic/tclHash.c 344
    8 bytes allocated at (.../incrTcl/itcl/generic/itcl_migrate.c 130)
    Memory validation failure
    Abort(coredump)
    
    
  4. foundin changed to: "obsolete: 8.5.12"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "bgriffin"
  10. subsystem changed to: "21. [namespace]"
  11. title changed to: "Tcl8.5 + incrTcl3.4 [variable] crash"
  12. type changed to: "Bug"