chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #653: Various port procedures do not properly check t


From: Chicken Trac
Subject: [Chicken-janitors] #653: Various port procedures do not properly check their port argument for being closed
Date: Sun, 17 Jul 2011 14:12:55 -0000

#653: Various port procedures do not properly check their port argument for 
being
closed
----------------------------------------------+-----------------------------
 Reporter:  sjamaan                           |       Owner:  felix
     Type:  defect                            |      Status:  new  
 Priority:  major                             |   Milestone:  4.8.0
Component:  core libraries                    |     Version:  4.7.x
 Keywords:  ports, argument checking, safety  |  
----------------------------------------------+-----------------------------
 This is quite problematic with the OpenSSL egg, it causes Chicken to
 segfault:

 {{{
 $ csi
 CHICKEN
 (c)2008-2011 The Chicken Team
 (c)2000-2007 Felix L. Winkelmann
 Version 4.7.0
 netbsd-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
 compiled 2011-05-25 on langly (NetBSD)

 #;1> (use openssl)
 ; loading /usr/pkg/lib/chicken/6/openssl.import.so ...
 ; loading /usr/pkg/lib/chicken/6/scheme.import.so ...
 ; loading /usr/pkg/lib/chicken/6/chicken.import.so ...
 ; loading /usr/pkg/lib/chicken/6/foreign.import.so ...
 ; loading /usr/pkg/lib/chicken/6/ports.import.so ...
 ; loading /usr/pkg/lib/chicken/6/srfi-18.import.so ...
 ; loading /usr/pkg/lib/chicken/6/tcp.import.so ...
 ; loading /usr/pkg/lib/chicken/6/openssl.so ...
 #;2> (define-values (in out) (ssl-connect "bugs.call-cc.org" 443))
 #;3> (display "HTTP/1.0 GET /\r\nHost: bugs.call-cc.org\r\n\r\n" out)
 #;4> (close-output-port out)
 #;5> (close-input-port in)
 #;6> (read-string 10 in)
 zsh: segmentation fault  csi
 }}}

 This is because read-string doesn't check if the port is closed. (in fact,
 if you try to read from the input port after leaving open the output port
 but closing the input port, it will return data anyway)

 Attached is a testsuite for the procedures I was able to find which need
 to check, and a patch to make them behave correctly.

 A few procedures even caused a *hang* when trying to read from closed
 ports!

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/653>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]