read from freed memory
Closed / Fixed1884496fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 14 years ago
Descriptionplain2008-02-01 15:26:26
Only on the dgp-refactor branch:
Following script reads from freed
memory (MEM_DEBUG build to verify):
set script {set a [p]; puts "result is $a"}
proc p {} {string first l $::script}
eval $script
Need some way to protect tokens getting
freed in the middle of evaluation.
ferrieuxplain2011-09-24 05:17:20
Is that still valid with all your valgrinding experience ? ;-)
ferrieuxplain2013-01-10 06:30:59
Tested today, --enable-symbols=all or mem, with or without valgrind, cannot seem to repro. Can you ?
dgpplain2013-01-10 22:14:26
This demo script stopped crashing with the checkin http://core.tcl.tk/tcl/info/815028bdfc This is when the NRE-enabled [eval] command was merged in. I think the change stopped this particular demo script from crashing, but didn't really address the underlying lack of lifetime management. Would need another demo to continue pursuing that.
dgpplain2013-01-10 22:59:20
The vulnerable point is TclNREvalObjEx() with the TCL_EVAL_DIRECT flag set. [eval] no longer goes there.
dgpplain2013-01-10 23:42:35
I see test execute-11.1 panic . Another symptom?
dgpplain2013-01-11 01:50:17
Nope that was 3600284
dgpplain2013-01-11 01:52:50
Updated demo of the problem:
$ make runtest
...
% set script {set a [p]; puts "result is $a"}
set a [p]; puts "result is $a"
% proc p {} {string first l $::script}
% testevent queue a head $script
% update
make: *** [runtest] Segmentation fault
ferrieuxplain2013-01-13 01:34:23
Fixed in commit 86e21dd01d by decoupling intreps just like for Lists. Please review. (that's a quick and dirty proof of concept; visibility of types and functions should be ironed out)
dgpplain2013-03-19 20:32:03
allow_comments - 1
Log in (anonymous is fine) to add a comment.