Skip to content
Tcl Source Code View Ticket
Login

View Ticket

"lsearch -exact -integer ..." crashes

Closed / Fixed1844789fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-12-05 12:42:33
"lsearch" crashes under certain circumstances:

Condition 1:
The list and the query object share the same Tcl_Obj.

Condition 2:
Options used for lsearch are "-exact" and "-integer" or "-real"

crash example1:
  set x 0
  set y $x
  lsearch -exact -integer $x $y


crash example2:
  set x 0.2
  set y $x
  lsearch -exact -real $x $y

does not crash (example1 without -exact):
  set x 0
  set y $x
  lsearch -integer $x $y

I tested this with tcl8.5b3 (windows) and tcl8.5b1 (linux)
dkf Ticket [1844789fff]: 3 changes [History diff]2007-12-05 20:15:58
msoferplain2007-12-05 20:29:54
Logged In: YES 
user_id=148712
Originator: NO

Verified also in 8.4 - ie, this is not due to the new List intrep.

Stack trace of the first example shows that itemPtr at line 3162 in tclCmdIl.c has both bytes and typePtr NULL, and refCount 0. This is not a valid state for a Tcl_Obj
dkf Ticket [1844789fff]: 1 change [History diff]2007-12-05 20:31:11
dkfplain2007-12-05 20:45:55
Logged In: YES 
user_id=79902
Originator: NO

Was a shimmering smash.
Log in (anonymous is fine) to add a comment.