Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 033780f00636e066ef1895fe72367c1baa652befa64ea5ffb2ddd55bced45b8d
Ticket: 409a4e5f2853644f6e78dce8f8d0d68a0d393dde
Abstract-list hooks: lpop and join/lset crash, lindex reads before buffer with a negative index
User & Date: serhiy.storchaka on 2026-10-18 18:49:47
Changes

  1. icomment:
    All four reproduced on trunk. Proposed fix in branch [/timeline?r=abstract-list-hook-fixes|abstract-list-hook-fixes]:
      *  F1: <nowiki>[lpop]</nowiki> now takes a reference to the result of <tt>setElementProc</tt>, like <nowiki>[lset]</nowiki>. The compiled multi-index <nowiki>[lset]</nowiki> (<tt>INST_LSET_FLAT</tt>) had the same missing reference.
      *  F2: <nowiki>[join]</nowiki> uses <tt>getElementsProc</tt> for any non-empty list.
      *  F3: the same use-after-free as [526b01c0b9]; its fix in branch [/timeline?r=lset-abstract-list-uaf|lset-abstract-list-uaf] makes <tt>lset l {1 0} X</tt> give <tt>a X c</tt>.
      *  F4: ObjectType.3 requires <tt>indexProc</tt> to accept out-of-range indices, so the core may pass -1; the bug is in lstring's <tt>indexProc</tt>, which now checks <tt>index < 0</tt>.
    
    Also fixed: <tt>lset l X</tt> without indices called <tt>setElementProc</tt> with no indices (lstring then fails with "bad index"). Tests abstractlist-5.1 to 5.4.
    
  2. login: "serhiy.storchaka"
  3. mimetype: "text/x-fossil-wiki"