Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: fca85637fef2adecc905125fb8efd33b5af1f31dd1c6f722e0903b1592d9e687
Ticket: e58d7e19e937496f179fe711345b415f3f3d31b2
Upwards compatibility of TclObjTypeHasProc()
User & Date: jan.nijtmans on 2023-07-29 20:57:02
Changes

  1. icomment:
    Let's actually demo the problem. Suppose there was a Tcl version before 9.0 which only had TCL_OBJTYPE_V1; indexProc and everything after that didn't exist yet. In 9.0, we have:
    <pre>
    #   define TCL_OBJTYPE_V1(a) 1, \
    	    a,0,0,0,0,0,0 /* Tcl 9 Version 1 */
    </pre>
    In this pre-9.0 header it would have looked like this:
    <pre>
    #   define TCL_OBJTYPE_V1(a) 1, \
    	    a /* pre-Tcl 9 Version 1 */
    </pre>
    that means - indexProc and everything after has random content, should never be accessed when running in 9.0.
    
    We can simulate such pre-9.0 V1 extension in 9.0, by changing it to:
    <pre>
    #   define TCL_OBJTYPE_V1(a) 1, \
    	    a,INT2PTR(1),INT2PTR(1),INT2PTR(1),INT2PTR(1),INT2PTR(1),INT2PTR(1) /* Tcl 9 Version 1 */
    </pre>
    If any after indexProc is not accessed it shouldn't matter .....  Well, it does!
    See: [https://core.tcl-lang.org/tcl/vinfo/cdcadcb3792b117e?diff=2]. Running this branch, tclsh immediately crashes.
    
    Brian, what more proof do you need? Does Ashok's explanation make sense to you?
     (to me it does!)
    
  2. login: "jan.nijtmans"
  3. mimetype: "text/x-fossil-wiki"