Skip to content
Tcl Source Code View Ticket
Login

View Ticket

bad argv handling for fconfigure -ttycontrol

Closed / Fixed1067708fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 21 years ago
Descriptionplain2004-11-16 23:25:18
Tcl 8.4.7, built with threads enabled, crashes when
configuring a serial port on a Linux system. The
following code  reproduces the problem:

> % info patchlevel
> 8.4.7
> % open /dev/ttyS0 {RDWR}
> file7
> % fconfigure file7 -mode "9600,n,8,1"
> % fconfigure file7 -ttycontrol {RTS 1 DTR 1}
> Segmentation fault

The fault appears to be specific to the 'ttycontrol'
option and does not happen on a non-threaded build. The
platform is Slackware Linux 9.1 with GCC 3.2.3 and
glibc 2.3.2. The configure options used to compile Tcl
were "--enable-shared --enable-threads".

George
fr30 at dial dot pipex dot com
hobbsplain2004-11-17 06:57:48
Logged In: YES 
user_id=72656

I believe the following patch is correct for 8.4.8.  Please
verify - may need adjustment for 8.5a2.
hobbsplain2004-11-17 06:57:49
File Added - 109035: 1067708.patch
dgp Ticket [1067708fff]: 1 change [History diff]2004-11-17 07:50:27
dgpplain2004-11-17 07:50:28
Logged In: YES 
user_id=80530

patch applies to both branches, and
after application the crash is gone in
both branches.

changes look correct too.
hobbs Ticket [1067708fff]: 1 change [History diff]2004-11-17 09:53:33
hobbsplain2004-11-17 09:53:34
Logged In: YES 
user_id=72656

Fixed this in 8.4.8 and 8.5a2.  Noticed that tclWinChan.c
avoided this by never freeing the argv array!  This moves to
an open bug on win/tclWinChan.c to free that memory
(correctly!).
dgpplain2004-12-02 05:22:02
Logged In: YES 
user_id=80530

should this be closed now?
andreas_kupriesplain2004-12-02 05:26:07
Logged In: YES 
user_id=75003

No, because we still have to fix the memleak on windows.
hobbsplain2005-10-05 13:34:26
Logged In: YES 
user_id=72656

properly free argv in 8.4.12 and 8.5a4.
Log in (anonymous is fine) to add a comment.

Attachments: