summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordgp <dgp@noemail.net>2009-03-20 14:22:54 (GMT)
committerdgp <dgp@noemail.net>2009-03-20 14:22:54 (GMT)
commit1a859e41363f365cdd3deddebbcfb3a323d19627 (patch)
treece7b88edde595de34cd2601e67e73645448852ff /generic/tclExecute.c
parente99cc4e02cbe2c35d29a39f2e3ce33bf614bdf09 (diff)
downloadtcl-1a859e41363f365cdd3deddebbcfb3a323d19627.zip
tcl-1a859e41363f365cdd3deddebbcfb3a323d19627.tar.gz
tcl-1a859e41363f365cdd3deddebbcfb3a323d19627.tar.bz2
* generic/tclExecute.c (INST_CONCAT1): Panic when appends overflow
the max length of a Tcl value. [Bug 2669109] FossilOrigin-Name: 7931b6b149a119e56b3cfe30483471670e3705e8
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 657ac80..065024c 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.94.2.27 2008/07/23 04:08:00 dgp Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.94.2.28 2009/03/20 14:22:54 dgp Exp $
*/
#include "tclInt.h"
@@ -1442,13 +1442,19 @@ TclExecuteByteCode(interp, codePtr)
* First, determine how many characters are needed.
*/
- for (i = (stackTop - (opnd-1)); i <= stackTop; i++) {
+ for (i = (stackTop - (opnd-1));
+ totalLen >= 0 && i <= stackTop; i++) {
bytes = Tcl_GetStringFromObj(stackPtr[i], &length);
if (bytes != NULL) {
totalLen += length;
}
}
+ if (totalLen < 0) {
+ Tcl_Panic("max size for a Tcl value (%d bytes) exceeded",
+ INT_MAX);
+ }
+
/*
* Initialize the new append string object by appending the
* strings of the opnd stack objects. Also pop the objects.