diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-10-06 09:45:49 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-10-06 09:45:49 (GMT) |
commit | 65254e27f9238b5be5dac497f9267fb484024829 (patch) | |
tree | 0d25d8a9635cbe7ee3116e23902d8a1df121b25c /generic/tclListObj.c | |
parent | 3cb6c489a3c0515c7b3aade0aaa139e637400559 (diff) | |
parent | 0b94a6293a785dce24805809dbceabca179de113 (diff) | |
download | tcl-65254e27f9238b5be5dac497f9267fb484024829.zip tcl-65254e27f9238b5be5dac497f9267fb484024829.tar.gz tcl-65254e27f9238b5be5dac497f9267fb484024829.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic/tclListObj.c')
-rw-r--r-- | generic/tclListObj.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 62bc162..78eb8a7 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -3417,7 +3417,8 @@ UpdateStringOfList( { # define LOCAL_SIZE 64 char localFlags[LOCAL_SIZE], *flagPtr = NULL; - ListSizeT numElems, i, length, bytesNeeded = 0; + ListSizeT numElems, i, length; + TCL_HASH_TYPE bytesNeeded = 0; const char *elem, *start; char *dst; Tcl_Obj **elemPtrs; @@ -3465,11 +3466,11 @@ UpdateStringOfList( flagPtr[i] = (i ? TCL_DONT_QUOTE_HASH : 0); elem = TclGetStringFromObj(elemPtrs[i], &length); bytesNeeded += TclScanElement(elem, length, flagPtr+i); - if (bytesNeeded < 0) { + if (bytesNeeded > INT_MAX) { Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX); } } - if (bytesNeeded > INT_MAX - numElems + 1) { + if (bytesNeeded + numElems > INT_MAX + 1U) { Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX); } bytesNeeded += numElems - 1; |