Artifacts Associated With Ticket 442665
Ticket change [02b5172395] (rid 119693) by jikamens on 2001-07-19 06:19:49:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
The function Tcl_GetsObjCmd in tclIOCmd.c can corrupt a freed object if it is called with objc == 3. This is because it retrieves resultPtr and does not increment its reference count, but then calls Tcl_ObjSetVar2, which causes the retrieved resultPtr object to be released. I will attach a patch, which I hope is correct (if not, please E-mail me and let me know why, so I can understand all of this better; I barely understand it).
- foundin initialized to: "obsolete: 8.3.1"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "jikamens"
- subsystem initialized to: "16. Commands A-H"
- title initialized to: "gets corrupts freed object"
- type initialized to: "Bug"
Add attachment "diff" [af9ca6e175] (rid 97846) by jikamens on 2001-07-19 13:19:50.
Ticket change [4ed4dccdfe] (rid 125710) by jikamens on 2001-07-19 13:19:50:
- icomment:
File Added - 8593: diff
- login: "jikamens"
- mimetype: "text/plain"
- username: "jikamens"
- icomment:
Ticket change [426b55c6e7] (rid 116379) by dgp on 2001-07-19 23:54:17:
- subsystem changed to: "24. Channel Commands"
- title changed to: "[gets] corrupts freed object"
Ticket change [2254826416] (rid 130730) by andreas_kupries on 2001-07-20 00:31:05:
- icomment:
Logged In: YES user_id=75003 Regarding "Tcl_ObjSetVar2" releasing the interp result. I took a look at the principal code, in "Tcl_SetVar2Ex" and found that the interp result is only released in the case of an error. In that case the result of the function is NULL, and this condition is catched by "Tcl_GetsObjCmd". So this shouldn't be a problem.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [a61f9936aa] (rid 98542) by andreas_kupries on 2001-07-20 00:38:23:
- icomment:
Logged In: YES user_id=75003 Still, in the code as is the call to "Tcl_GetsObj" can and will directly modify the interp result without announcing its reference in the case of objc == 2. This gave trouble in the past with transformations, i.e. channel drivers, which called back into the script level, thus modifying the interp result, if they didn't do a save/restore on the previous result.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [48b749cff7] (rid 99942) by andreas_kupries on 2001-07-20 01:18:59:
- assignee changed to: "andreas_kupries"
Ticket change [8186848488] (rid 117053) by jikamens on 2001-07-20 02:10:52:
- icomment:
Logged In: YES user_id=274776 Hmm. I'm not following everything that Andreas is saying. I confess that I didn't fully understand the mechanisms I was trying to fix. But I assure you that TCL was core-dumping without my fix, and when I recompiled it with TCL_MEM_DEBUG, the call to Tcl_SetIntObj was failing, claiming that it was trying to set a disposed pointer. When I recompiled with my fix, that error went away when TCL_MEM_DEBUG remained set and the coredump went away when I unset it. I don't think I have anything more useful to contribute :-).
- login: "jikamens"
- mimetype: "text/plain"
- username: "jikamens"
- icomment:
Ticket change [87d4f42573] (rid 131767) by andreas_kupries on 2001-07-20 03:09:19:
- icomment:
Logged In: YES user_id=75003 Can you attach the script which produces the core dump to this item ?
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [8c84eaad97] (rid 127755) by jikamens on 2001-07-20 03:16:21:
- icomment:
Logged In: YES user_id=274776 No, I can't, because it's a large package (cbb, the Check Book Balancer) with lots of local customizations, and the coredump seems to be dependent on the specific data being imported, and I can't exactly send you my checkbook data. I had sort of hoped that the correctness of my fix would be apparent to someone who understands tcl's internals more than I do. It was *mostly* apparent to me, and I barely understand the internals at all. Apparently it's more complex than I thought.
- login: "jikamens"
- mimetype: "text/plain"
- username: "jikamens"
- icomment:
Ticket change [6cd1a96d0f] (rid 128587) by andreas_kupries on 2001-08-07 05:19:00:
- closedate changed to: "2001-08-06T22:19:00"
- closer changed to: "andreas_kupries"
- icomment:
Logged In: YES user_id=75003 Comitted.
- login: "andreas_kupries"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "andreas_kupries"
Ticket change [599bb608ff] (rid 117998) by jikamens on 2001-08-07 07:37:10:
- closedate changed to: "2001-08-07T00:37:10"
- closer changed to: "jikamens"
- icomment:
Logged In: YES user_id=274776 I'm finding this whole conversation really puzzling. I'm sorry to keep repeating myself, but I find it necessary to do so.... As I said, I can't comment on *why* there's a problem in the code. All I know is that when I compiled TCL with memory debugging enabled, the memory debugging code told me quite explicitly that there was a problem, and after I applied the fix which I submitted, the problem went away. What I find puzzling is that you seem willing to write off this bug and close it without determining why I was seeing a problem before my fix and not afterwards. It seems like you think I'm making up the bug report or something. Why would I make up the fact that the TCL memory debugging code was reporting a problem before my fix and not reporting a problem afterwards? In short, it seems to me that you should not close the bug without taking any action until you have understood why I was seeing a problem, and it seems that you haven't done that.
- login: "jikamens"
- mimetype: "text/plain"
- username: "jikamens"
Ticket change [4bbabd2e25] (rid 126759) by dgp on 2001-08-07 08:01:08:
- closedate changed to: "2001-08-07T01:01:08"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 Why are you complaining? Your patch was accepted into the development sources and will be part of releases Tcl 8.3.4 and Tcl 8.4a3. Isn't that what you want?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [3a7b5a079b] (rid 112569) by jikamens on 2001-08-07 08:03:27:
- closedate changed to: "2001-08-07T01:03:27"
- closer changed to: "jikamens"
- icomment:
Logged In: YES user_id=274776 Doh! I was complaining because I thought my patch *wasn't* accepted! I misread the bug report because I read it from top to bottom when I should have been reading it from bottom to top. I find this interface which puts the description of the bug first but then puts comments from most to least recent quite confusing :-). Sorry about that. Thanks.
- login: "jikamens"
- mimetype: "text/plain"
- username: "jikamens"