Skip to content
Tcl Source Code History Of Ticket 3595762fffffffffffffffffffffffffffffffff
Login

History Of Ticket 3595762fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 3595762fffffffffffffffffffffffffffffffff

  1. Ticket change [4adfa90abe] (rid 126606) by apnadkarni on 2012-12-14 03:10:43:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      There is a Tcl_DecrRefCount (patObj) (~line 3425 of TclCmdIL.c) which does not seem to have a matching Tcl_IncrRefCount. patObj is not newly allocated, it is equated to objv[...] on line 3197.
      
      I don't know how to exercise that code, because I don't think the enclosing Tcl_RegExpExecObj call enclosing it can actually fail, the regexp having been already successfully compiled before without errors further up in the code. So in that sense it might be dead code but still...
      
      /Ashok
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "apnadkarni"
    10. subsystem initialized to: "17. Commands I-L"
    11. title initialized to: "Extra Tcl_DecrRefCount in Tcl_LSearchjObjCmd"
    12. type initialized to: "Bug"
  2. Ticket change [6f038f2e6f] (rid 100237) by apnadkarni on 2012-12-14 10:30:33:

    1. foundin changed to: "obsolete: 8.6b3"
  3. Ticket change [9732138f02] (rid 106464) by dkf on 2012-12-17 20:31:46:

    1. icomment:
      I've reviewed the code, and the only problem cases are when the RE engine core throws REG_ASSERT or REG_ESPACE. The first is a "Yow! RE engine bug found!" and the second is running out of memory for what is typically a modest memory allocation (i.e., highly fatal to Tcl which exercises the memory subsystem pretty hard). The glue layer connecting Tcl to the RE engine ensures that other error cases don't happen (we match our RE compilations and executions correctly) or are caught earlier.
      
      In other words, I don't think it is possible to actually exercise this bug.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  4. Ticket change [b328558b7d] (rid 98476) by dkf on 2012-12-17 20:31:47:

    1. priority changed to: "4"
  5. Ticket change [dad15f2542] (rid 257614) by serhiy.storchaka on 2026-10-11 11:20:44:

    1. icomment:
      This is reachable: matching fails with "out of memory" when the dissector's
      per-character work array cannot be allocated, e.g. for a quantified group with a
      backref on a long string. The extra <code>Tcl_DecrRefCount(patObj)</code> then
      frees the pattern while it is still in use. Reproducer: run
      <code>(ulimit -v 1100000; tclsh lsearch-uaf.tcl)</code> with
      <verbatim>
      proc t {} {
          set l [list [string repeat a 100000000]]
          set pat [string cat {^(?:(a)\1)*} {$}]
          for {set i 0} {$i < 4} {incr i} {
      	catch {lsearch -regexp $l $pat} msg
      	puts "$msg: $pat"
          }
      }
      t
      </verbatim>
      On 9.0.5 the last line prints <code>invokeStk1</code> instead of the pattern.
      Proposed fix in branch [/timeline?r=lsearch-regexp-error-refcount|lsearch-regexp-error-refcount].
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  6. Ticket change [b208c9ba88] (rid 257615) by serhiy.storchaka on 2026-10-11 11:20:44:

    1. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
    2. login: "serhiy.storchaka"
  7. Ticket change [0ad1d5763b] (rid 257901) by jan.nijtmans on 2026-10-13 12:27:36:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2461327.0191766666"
    3. closer changed to: "jan.nijtmans"
    4. comment changed to:
      There is a Tcl_DecrRefCount (patObj) (~line 3425 of TclCmdIL.c) which does not seem to have a matching Tcl_IncrRefCount. patObj is not newly allocated, it is equated to objv[...] on line 3197.
      
      I don't know how to exercise that code, because I don't think the enclosing Tcl_RegExpExecObj call enclosing it can actually fail, the regexp having been already successfully compiled before without errors further up in the code. So in that sense it might be dead code but still...
      
      /Ashok
      
    5. icomment:
      Fixed in [cd129688d2|trunk], core-9-0-branch and core-8-6-branch
      
    6. login: "jan.nijtmans"
    7. mimetype: "text/x-fossil-wiki"
    8. resolution changed to: "Fixed"
    9. severity changed to: "Minor"
    10. status changed to: "Closed"