Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7490cd239f0cd1a7854f9b5362a32aef7b9418e26ef147d906c41f93960db9ad
Ticket: 7c2716733a526ba6d08eccbf27b6a07f8b081cff
App Verifier shows use-after-free on event handle for Windows pipes
User & Date: apnadkarni on 2025-06-13 11:48:28
Changes

  1. icomment:
    Looking at the source, the event handle seems to have been already closed [here](https://core.tcl-lang.org/tcl/file?ci=950d15a307bcbf94&name=win/tclWinPipe.c&ln=2037).
    
    It *seems* to me that the immediately preceding `TclPipeThreadStop` wakes up the worker thread, transitioning it to the STOP state where it invokes SetEvent(). In the meanwhile, the code after `TclPipeThreadStop` immediately closes that event handle before the worker actually runs. Hence the invalid handle error.
    
    I don't know what the synchronization protocol is between the main and worker threads so leaving investigation and fix to those who do.
    
    As an aside, seems like this extends way back to 8.6.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"