lreverse shared intrep bug
Closed / Fixed1675044fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2007-03-06 16:11:28
It is possible for an unshared "list" Tcl_Obj to have a List intrep that it shares with another Tcl_Obj. This means that checking for a shared Tcl_Obj isn't enough, a check for a shared intrep is also needed before any direct modifications of the intrep, as are done around lines 3386-3393. Would probably be better to shift the proper functionality that would rely more on intrep details to tclListObj.c, and then call some new routine like TclListObjReverse(). I have not yet been able to construct a test script to demo the bug.
dkfplain2007-03-11 23:56:04
Logged In: YES user_id=79902 Originator: NO Fixed (though I worry that it was never possible to demonstrate the bug in a test).
dgpplain2007-03-14 00:30:31
Logged In: YES
user_id=80530
Originator: YES
Here's a test:
testConstraint testobj [llength [info commands testobj]]
test cmdIL-7.7 {lreverse command - shared intrep [Bug 1675044]} -setup {
teststringobj set 1 {1 2 3}
testobj convert 1 list
testobj duplicate 1 2
variable x [teststringobj get 1]
variable y [teststringobj get 2]
testobj freeallvars
proc K {a b} {return $a}
} -constraints testobj -body {
lreverse [K $y [unset y]]
lindex $x 0
} -cleanup {
unset -nocomplain x y
rename K {}
} -result 1
Log in (anonymous is fine) to add a comment.