Overview
| Artifact ID: | 4a53ecc6d94e1098b8e134e6a068a04ea9e4f5fd |
|---|---|
| Ticket: | 32ae34e63a3db0a542a6795594914baa1f231007
[chan copy] reflected channel segfault |
| User & Date: | dgp on 2015-08-11 20:55:30 |
Changes
- icomment:
The problem here is that [driver watch] makes a direct call to [chan postevent] which directly calls Tcl_NotifyChannel. This chain of events makes it possible for the internal routine CopyData() to recursively call itself. Problem is that CopyData() has not been written to support a recursive call to itself. It's written to support a strict assumption that all calls to it come from an event handler that has been scheduled by other instances of CopyData(). Specifically each call to CopyData passes in a pointer to a CopyState struct and management of the lifetime of that struct doesn't account for any recursive operations, only event chained operations. If a recursive call does get made -- as in this demo script -- the inner CopyData() can free the CopyState struct and then leave the outer CopyData pointing to and using freed memory, which is the case here.
- login: "dgp"
- mimetype: "text/plain"