|
2005-10-22
| ||
| 10:37 | • Closed ticket [1189274fff]: Crash in TclExecuteByteCode plus 6 other changes artifact: f2ad5494d4 user: msofer | |
|
2005-04-25
| ||
| 21:14 | • Ticket [1189274fff]: 4 changes artifact: 2bdb4d6ead user: jenglish | |
| 17:11 | • Open ticket [1189274fff]. artifact: e134ee57f2 user: msofer | |
| 17:10 | • Closed ticket [1189274fff]. artifact: 78b3684ebf user: msofer | |
| 17:08 | • Ticket [1189274fff]: 4 changes artifact: 8ed4eba88e user: msofer | |
| 17:03 | • Ticket [1189274fff]: 4 changes artifact: 7190f27bac user: dkf | |
| 06:41 | • New ticket [1189274fff]. artifact: 0b26497517 user: jenglish | |
Crash in TclExecuteByteCode
Closed / Fixed1189274fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 21 years ago
Descriptionplain2005-04-25 06:41:42
CVS HEAD (24 Apr 2005), getting a SIGSEGV in
TclExecuteByteCode line 4755:
Tcl_IncrRefCount(valuePtr);
Haven't isolated the Tcl code that's causing this, but
examining in GDB: valuePtr is NULL; it looks like it
was set earlier at line 4736
valuePtr = elements[valIndex];
elements and listLen were set earlier at line 4727:
TclListObjGetElements(listPtr, listLen, elements);
but listPtr->typePtr is 0, (contrary to the documented
precondition of the TclListObjGetElements macro "do NOT
forget to verify that it of list type before using!").
listPtr->bytes is the empty string ""; internal rep is
apparently random garbage.
dkfplain2005-04-25 17:03:44
Logged In: YES user_id=79902 This is in INST_FOREACH_STEP4, and experience with intrep shimmering nightmares indicates that in the case of being unable to *guarantee* the type, you have to take the safe approach instead. In this case, I suspect (from looking at the code) the problem is that the assumption that Tcl_ListObjLength used to be assumed to convert the object type to list, but no longer does. I've not figured out how to induce the fault.
msoferplain2005-04-25 17:08:06
Logged In: YES
user_id=148712
As noted in the comment in line 4755 "We already checked
above that each list temp holds a valid list object".
Specifically, the call to Tcl_ListObjLength at line 4700
shimmers the obj to listType (or leaves it unchanged if its
string rep is {}).
Hence, whenever the obj has an empty string rep,
TclListObjGetElements sets the variable listLen to garbage.
This is indeed a bad bug, which will show its face whenever
the junky listLen is less than valIndex.
TclListObjGetElements should *not* be have been used here
anyway (ie, even if no list is empty): it is possible that
one of the lists gets shimmered out of listType as a side
effect of setting a previous var, there is no guarantee that
the check at line 4700 remains valid when we get to line
4727 in the case i>0.
msoferplain2005-04-25 17:10:42
Logged In: YES user_id=148712 Fixed by replacing TclListObjGetElements by Tcl_ListObjGetElements (which knows how to handle empty lists which are not of listType, pending the reversion of the special case for empty lists in [Patch 1158008], see also [Bug 1178805]
msoferplain2005-04-25 17:11:48
Logged In: YES user_id=148712 Oops: reopening. It *is* fixed, but this deserves consideration in the testsuite.
jenglishplain2005-04-25 21:14:29
Logged In: YES
user_id=68433
This reproduces the crash for me:
proc crash {} {
set a "x y z"
set b ""
foreach aa $a bb $b { puts "aa = $aa bb = $bb" }
}
msoferplain2005-10-22 10:37:51
Logged In: YES user_id=148712 test foreach-8.1 added
Log in (anonymous is fine) to add a comment.