summaryrefslogtreecommitdiffstats
path: root/generic/tclThreadStorage.c
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 /generic/tclThreadStorage.c
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.
Diffstat (limited to 'generic/tclThreadStorage.c')
-rw-r--r--generic/tclThreadStorage.c6
1 files changed, 3 insertions, 3 deletions
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 */