ports/51273: tcl-8.3.5 can core dump in TclFinalizeEncodingSubsystem() [patch]

Don Lewis truckman at FreeBSD.org
Tue Apr 22 10:40:08 UTC 2003


>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 at 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:



More information about the freebsd-ports-bugs mailing list