Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-12
17:51 • Pending ticket [1888596fff]: Segfault with tclhttpd and TLS plus 4 other cha... artifact: 14a1628132 user: serhiy.storchaka
2012-05-30
17:58 • Ticket [1888596fff]: 4 changes artifact: 396a0b0662 user: dkf
17:56 • Ticket [1888596fff]: 3 changes artifact: 532e3277c1 user: dkf
2008-02-09
05:30 • Ticket [1888596fff]: 1 change artifact: c45958c4b7 user: dkf
2008-02-07
15:57 • Ticket [1888596fff]: 4 changes artifact: 7aa7944856 user: eriklns
15:57 • Add attachment backtrace.txt to ticket [1888596fff] artifact: 3f82574e85 user: eriklns
08:57 • New ticket [1888596fff] Segfault with tclhttpd and TLS. artifact: f9c4a3b417 user: eriklns

Segfault with tclhttpd and TLS

Pending1888596fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 51 days ago
Descriptionplain2008-02-07 08:57:04
I experienced a segfault with Tcl8.4.17, when running tclhttpd (under Linux; I'm unsure whether the OS matters).

Reproducing the segfault involves tclhttpd (3.5.1) and probably tls1.5 as follows:

- Launch tclhttpd and make it listen at a https port, using TLS. I'm using libtls1.5.so, and configured tclhttpd to use TLSv1 only, using the standard configuration file settings. Although libtls1.5.so doesn't show up in the backtrace below, I can't get the  segfault to occur when using regular (non-TLS) channels.

- From a http client, send a request with a malformed header. Receiving the malformed header is what triggers the server. I'm using the Tcl http client package, like this:

    http::register https $httpsPort [list ::tls::socket \
        -request 1 -require 1 -ssl2 0 -ssl3 0 -tls1 1 \
        -cafile [file join $Dir(cert) cacert.pem]]
    http::geturl https://$host:$port -headers [list {garbage 1}]

  (You may need to retry submitting several times before the server crashes)

A full backtrace from the core dump has been attached.
eriklnsplain2008-02-07 15:57:05
File Added - 265401: backtrace.txt
dkf Ticket [1888596fff]: 1 change [History diff]2008-02-09 05:30:50
dkf Ticket [1888596fff]: 3 changes [History diff]2012-05-30 17:56:09
dkfplain2012-05-30 17:58:28
Hmm, tls package not in stack trace...
serhiy.storchakawiki2026-10-12 17:51:03

I cannot reproduce it. A writable fileevent script that closes its channel, replaces or deletes its own handler and then fails does not crash 8.6.18 or 9.1, and valgrind shows no errors. TclChannelEventScriptInvoker() now saves the event mask before evaluating the script, preserves the channel and does not touch the script records if the channel was closed.

Log in (anonymous is fine) to add a comment.

Attachments: