Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 354da95bc2a9512c5eb70767a7c63bd99180a08d88982306425686a96aa14cdb
Ticket: 40b1814b93e50b4a9627e6651184880233d63616
App verifier shows user-after-free on ThreadSpecificData for Windows sockets
User & Date: apnadkarni on 2025-06-13 17:43:50
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-markdown"
  4. comment changed to:
    The offending tsdPtr access is [here](https://core.tcl-lang.org/tcl/file?ci=950d15a307bcbf94&name=win/tclWinSock.c&ln=3055) and happens on exit.
    
    Preliminary thoughts:
    
    Why does this show up only under AppVerifier? Because it scrubs memory and protects freed blocks (above requires compile with -DPURIFY so Tcl_Alloc translates directly to malloc). Under normal operation, the freed tsdPtr page remains accessible though the memory block has been freed. The tsdPtr->readyEvent actually is garbage data and so the SetEvent call which checks for valid handles returns an error which Tcl ignores.
    
    Note the tsdPtr referenced above is thread specific data in a *different* thread which is really asking for trouble but it appears to have been that way forever, likely even before 8.6.
    
  5. foundin changed to: "trunk"
  6. is_private changed to: "0"
  7. login: "apnadkarni"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "apnadkarni"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to:
    App verifier shows user-after-free on ThreadSpecificData for Windows sockets
    
  16. type changed to: "Bug"