Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Apr 2003 03:30:48 -0700 (PDT)
From:      Don Lewis <truckman@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        dinoex@FreeBSD.org
Subject:   ports/51273: tcl-8.3.5 can core dump in TclFinalizeEncodingSubsystem() [patch]
Message-ID:  <200304221030.h3MAUm0v048331@scratch.catspoiler.org>
Resent-Message-ID: <200304221040.h3MAe6o2063584@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         51273
>Category:       ports
>Synopsis:       tcl-8.3.5 can core dump in TclFinalizeEncodingSubsystem() [patch]
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 22 03:40:06 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Don Lewis
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD scratch.catspoiler.org 5.0-CURRENT FreeBSD 5.0-CURRENT #63: Tue Apr 22 01:56:15 PDT 2003 dl@scratch.catspoiler.org:/usr/obj/usr/src/sys/GENERICSMB i386


	
>Description:
	Certain character set encodings can cause tcl to core dump in
	TclFinalizeEncodingSubsystem().

>How-To-Repeat:
	Use the mail/tkrat2 port to view email containing text encoded
	in the character sets used by various Far East languages.

>Fix:
	Apply the following patch obtained from tcl 8.4:

--- ../generic/tclEncoding.c.orig	Thu Apr  5 13:28:52 2001
+++ ../generic/tclEncoding.c	Thu Apr 10 00:49:34 2003
@@ -310,19 +310,19 @@
 {
     Tcl_HashSearch search;
     Tcl_HashEntry *hPtr;
-    Encoding *encodingPtr;
 
     Tcl_MutexLock(&encodingMutex);
     encodingsInitialized  = 0;
     hPtr = Tcl_FirstHashEntry(&encodingTable, &search);
     while (hPtr != NULL) {
-	encodingPtr = (Encoding *) Tcl_GetHashValue(hPtr);
-	if (encodingPtr->freeProc != NULL) {
-	    (*encodingPtr->freeProc)(encodingPtr->clientData);
-	}
-	ckfree((char *) encodingPtr->name);
-	ckfree((char *) encodingPtr);
-	hPtr = Tcl_NextHashEntry(&search);
+	/*
+	 * Call FreeEncoding instead of doing it directly to handle refcounts
+	 * like escape encodings use.  [Bug #524674]
+	 * Make sure to call Tcl_FirstHashEntry repeatedly so that all
+	 * encodings are eventually cleaned up.
+	 */
+	FreeEncoding((Tcl_Encoding) Tcl_GetHashValue(hPtr));
+	hPtr = Tcl_FirstHashEntry(&encodingTable, &search);
     }
     Tcl_DeleteHashTable(&encodingTable);
     Tcl_MutexUnlock(&encodingMutex);


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304221030.h3MAUm0v048331>