summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-06-24 04:13:29 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-06-24 04:13:29 (GMT)
commit9cebda93e36e028c22404140806f1ef2f80f1f86 (patch)
tree0e6953d32077345f128fd11f93e80553d863182b
parent29cd385014b7d98f9e1209da72adade7679e3cf2 (diff)
downloadtcl-9cebda93e36e028c22404140806f1ef2f80f1f86.zip
tcl-9cebda93e36e028c22404140806f1ef2f80f1f86.tar.gz
tcl-9cebda93e36e028c22404140806f1ef2f80f1f86.tar.bz2
* generic/tclThreadStorage.c: Corrected type casting errors that led
to calculation of a negative index value, thus accesses outside the threadStorageCache array, thus memory corruption. Crash observed on Mac OS X platform.
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclThreadStorage.c6
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b71113a..c49369e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-06-23 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclThreadStorage.c: Corrected type casting errors that led
+ to calculation of a negative index value, thus accesses outside the
+ threadStorageCache array, thus memory corruption. Crash observed on
+ Mac OS X platform.
+
2004-06-23 Joe Mistachkin <joe@mistachkin.com>
* generic/tclThread.c: Implements platform independent thread storage
diff --git a/generic/tclThreadStorage.c b/generic/tclThreadStorage.c
index aa04cfc..81c1e61 100644
--- a/generic/tclThreadStorage.c
+++ b/generic/tclThreadStorage.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclThreadStorage.c,v 1.1 2004/06/24 01:29:02 mistachkin Exp $
+ * RCS: @(#) $Id: tclThreadStorage.c,v 1.2 2004/06/24 04:13:30 dgp Exp $
*/
#include "tclInt.h"
@@ -358,7 +358,7 @@ Tcl_HashTable *
TclThreadStorageGetHashTable(id)
Tcl_ThreadId id; /* Id of the thread to get the hash table for */
{
- int index = (int)id % STORAGE_CACHE_SLOTS;
+ int index = (unsigned int)id % STORAGE_CACHE_SLOTS;
Tcl_HashEntry *hPtr;
int new;
@@ -660,7 +660,7 @@ void
TclFinalizeThreadStorageThread(id)
Tcl_ThreadId id; /* Id of the thread to finalize */
{
- int index = (int)id % STORAGE_CACHE_SLOTS;
+ int index = (unsigned int)id % STORAGE_CACHE_SLOTS;
Tcl_HashTable *hashTablePtr; /* hash table for current thread */
Tcl_HashEntry *hPtr; /* hash entry for current thread in master table */