From 8241e0c897749cfb51138f389c8dfe44596f739f Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 3 Feb 2009 18:16:07 +0000 Subject: Fix for [Bug 2558422] though this area is still a mess. --- ChangeLog | 19 ++++++++++++------- generic/tclObj.c | 12 ++++++++++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index d29a14c..993b64e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-02-03 Donal K. Fellows + + * generic/tclObj.c (tclCmdNameType): [Bug 2558422]: Corrected the type + of this structure so that extensions that write it (yuk!) will still + be able to function correctly. + 2009-02-03 Don Porter * generic/tclStringObj.c (SetUnicodeObj): Corrected failure of @@ -15,18 +21,17 @@ significant forkage of the 8.5 and 8.6 implementations -- that are better off avoided if there's no gain. - * generic/tclStringObj.c (STRING_NOMEM): Add missing cast of - NULL to (char *) that upsets some compilers. [Bug 2494093]. + * generic/tclStringObj.c (STRING_NOMEM): [Bug 2494093]: Add missing + cast of NULL to (char *) that upsets some compilers. - * generic/tclStringObj.c (Tcl_(Attempt)SetObjLength): Added - protections against callers asking for negative lengths. It is + * generic/tclStringObj.c (Tcl_(Attempt)SetObjLength): [Bug 2553906]: + Added protections against callers asking for negative lengths. It is likely when this happens that an integer overflow is to blame. - [Bug 2553906]. 2009-02-01 David Gravereaux - * win/makefile.vc: Allow nmake flags such as -a (rebuild - all) to pass down to the pkgs targets, too. + * win/makefile.vc: Allow nmake flags such as -a (rebuild all) to pass + down to the pkgs targets, too. 2009-01-30 Donal K. Fellows diff --git a/generic/tclObj.c b/generic/tclObj.c index 93cf2f4..72de8f4 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.148 2009/02/03 17:15:28 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.149 2009/02/03 18:16:07 dkf Exp $ */ #include "tclInt.h" @@ -277,9 +277,17 @@ const Tcl_HashKeyType tclObjHashKeyType = { * ResolvedCmdName pointer, but DO NOT DO THIS. It seems that some extensions * use the second internal pointer field of the twoPtrValue field for their * own purposes. + * + * TRICKY POINT! Some extensions update this structure! (Notably, these + * include TclBlend and TCom). This is highly ill-advised on their part, but + * does allow them to delete a command when references to it are gone, which + * is fragile but useful given their somewhat-OO style. Because of this, this + * structure MUST NOT be const so that the C compiler puts the data in + * writable memory. [Bug 2558422] + * TODO: Provide a better API for those extensions so that they can coexist... */ -static const Tcl_ObjType tclCmdNameType = { +Tcl_ObjType tclCmdNameType = { "cmdName", /* name */ FreeCmdNameInternalRep, /* freeIntRepProc */ DupCmdNameInternalRep, /* dupIntRepProc */ -- cgit v0.12