Skip to content
Tcl Source Code View Ticket
Login

View Ticket

TclOO method with non-literal value for body argument causes segmentation fault

Closed / Fixedfc1409fc9193f33f39f7e6ea353364a9a4b8048cCreated 9 years agoUpdated 9 years ago
Descriptionwiki2017-10-19 21:26:13
The following script causes a segmentation fault:

::oo::objdefine oo::object {
	method m1 {} [string map {a b} hello] 
}

oo::copy oo::object obj1
obj1 m1 

This is a regression cause by the fix to bug 3609693. In TclOOMethod.c/CloneProcedureMethod, TclFreeIntRep(bodyObj) occurs on a Tcl_Obj that has no string representation. The solutions is to call Tcl_GetString(bodyObj) first.

Referenced by3
  • 0aa4803addCherrypick: [fc1409fc91] Method cloning needs to be careful with body representations. check-in2017-10-24 14:11:16
  • 0d7a96d2b5[fc1409fc91] Method cloning needs to be careful with body representations. check-in2017-10-24 11:25:29
  • d6d4b18fc1[fc1409fc91]: TclOO method with non-literal value for body argument causes segmentation fault check-in2017-10-24 08:38:17
pooryorickplain2017-10-24 08:47:01
Fixed in commit d6d4b18fc1.
dkfplain2017-10-24 11:16:34
Needs that code worked into a test. I'll sort it.
dkf Closed ticket [fc1409fc91]. [History diff]2017-10-24 14:11:55
Log in (anonymous is fine) to add a comment.