Tcl Source Code

Ticket Change Details
Login
Overview

Artifact ID: b6d1b9e0db3f56d9f329ef8bec1ed0eb652e52bb
Ticket: 0f94f855cafed92d0e174b7d835453a02831b4dd
Infinite loop on writing to TLS channel on negotiation failure
User & Date: apnadkarni 2015-03-27 12:56:56
Changes

  1. icomment:
    Tracing through the code, the loop is caused by the following sequence:
    
    - The TLS negotiation is initiated by the flush
    - Negotiation fails and the remote end closes the underlying TCP socket
    - Tls_WaitForConnect detects EOF and returns 0 (lines 916-7 in tlsIO.c)
    - The return value bubbles up to FlushChannel which treats this as the number
    of bytes written (tclIO.c line 2694), decrements the write count by this number (0) and loops around to write again which gets dispatched to Tls_WaitForConnect. Which gets us back to the previous step.
    
  2. login: "apnadkarni"
  3. mimetype: "text/plain"