Skip to content
Tcl Source Code History Of Ticket 7e3f26
Login

History Of Ticket 7e3f26

Artifacts Associated With Ticket 7e3f26

  1. Ticket change [453ef14773] (rid 211684) by apnadkarni on 2023-04-02 12:04:27:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-markdown"
    4. comment initialized to:
      Tcl built with `TCL_MEM_DEBUG` triggers a panic when decrementing the reference count of 0x61616161. This is a perfectly valid reference count in Tcl 9.
      
      Encountered while testing lrepeat
      
      ```
      % llength [lrepeat 0x61616162 x]
      file = d:\src\tcltk\trunk\tcl\win\..\generic\tclListObj.c, line = 440
      decrementing refCount of previously disposed object
      ```
      
    5. foundin initialized to: "9.0"
    6. is_private initialized to: "0"
    7. login: "apnadkarni"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "apnadkarni"
    14. subsystem initialized to: "- New Builtin Commands"
    15. title initialized to:
      Memory corruption false positive with TCL_MEM_DEBUG
      
    16. type initialized to: "Bug"
  2. Ticket change [5076bd92a7] (rid 211685) by apnadkarni on 2023-04-02 12:13:04:

    1. icomment:
      Note on 8.x and 32-bit 9.0 this particular test case does not succeed as lists of that size are not permitted
      
      ```
      % llength [lrepeat 0x61616162 x]
      max length of a Tcl list (536870906 elements) exceeded
      ```
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  3. Ticket change [45abbdd3b7] (rid 211688) by apnadkarni on 2023-04-02 13:26:30:

    1. icomment:
      Fixed for 9.0 in [f505b17748]. Leaving open for time being to see if it can be reproduced in 8.x or 32-bit Tcl. If so, the 0x61616161 pattern may have to change one with high bit set.
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-fossil-plain"
  4. Ticket change [cfb935d355] (rid 211689) by fvogel on 2023-04-02 17:37:29:

    1. icomment:
      In addition to [f505b17748] the codebase features 4 more occurrences of the same 0x61616161 special value, one in tclDisassemble and three in tclPreserve. Shouldn't these be considered to be renamed FREEDREFCOUNTFILLER?
      
    2. login: "fvogel"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [b6f0b7e761] (rid 211745) by apnadkarni on 2023-04-03 02:09:32:

    1. icomment:
      You're right. Also, rethinking the 32-bit case, perhaps the issue could arise there as well for other object types. Maybe the 61 marker should be changed to something like E8 (high bit set, printable) to reduce the chances of this occurring in 32-bit systems (6161616161616161 is basically impossible in 64-bit systems (unless one artificially keeps incrementing for no reason) but 61616161 may be feasible on 32-bits with valid references.
      
      I'll wait in case someone else has comments/ideas to fix both these. Keeping ticket open for now.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  6. Ticket change [f0408fa16d] (rid 258978) by serhiy.storchaka on 2026-10-18 10:03:22:

    1. foundin changed to: "9.0.5, 9.1.0"
    2. icomment:
      [f505b17748] changed the expected refCount of freed objects to <tt>0xE8...</tt>, but <tt>Tcl_DbCkfree</tt> still fills freed memory with <tt>0x61</tt>, so the "decrementing refCount of previously disposed object" panic can no longer fire; a use-after-free decrement is caught only by the threaded check ("Tcl_Obj allocated in another thread", without file and line). The <tt>0x61616161</tt> checks in tclDisassemble.c and tclPreserve.c never matched on 64-bit either.
      
      Proposed fix in branch [/timeline?r=memdebug-freed-marker|memdebug-freed-marker]: <tt>Tcl_DbCkfree</tt> fills freed memory with <tt>0xE8</tt>, as suggested here, and all five checks use the same marker. A use-after-free decrement now panics with the file and line again.
      
    3. login: "serhiy.storchaka"
    4. mimetype: "text/x-fossil-wiki"