summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclExecute.c6
-rw-r--r--generic/tclInt.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index aacf565..4d92468 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -914,8 +914,8 @@ TclCreateExecEnv(
* [sizeof(Tcl_Obj*)] */
{
ExecEnv *eePtr = ckalloc(sizeof(ExecEnv));
- ExecStack *esPtr = ckalloc(sizeof(ExecStack)
- + (size_t) (size-1) * sizeof(Tcl_Obj *));
+ ExecStack *esPtr = ckalloc(TclOffset(ExecStack, stackWords)
+ + size * sizeof(Tcl_Obj *));
eePtr->execStackPtr = esPtr;
TclNewBooleanObj(eePtr->constants[0], 0);
@@ -1180,7 +1180,7 @@ GrowEvaluationStack(
newElems = needed;
#endif
- newBytes = sizeof(ExecStack) + (newElems-1) * sizeof(Tcl_Obj *);
+ newBytes = TclOffset(ExecStack, stackWords) + newElems * sizeof(Tcl_Obj *);
oldPtr = esPtr;
esPtr = ckalloc(newBytes);
diff --git a/generic/tclInt.h b/generic/tclInt.h
index e145925..fe69b26 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -1409,7 +1409,7 @@ typedef struct ExecStack {
Tcl_Obj **markerPtr;
Tcl_Obj **endPtr;
Tcl_Obj **tosPtr;
- Tcl_Obj *stackWords[1];
+ Tcl_Obj *stackWords[TCLFLEXARRAY];
} ExecStack;
/*