diff options
Diffstat (limited to 'generic')
| -rw-r--r-- | generic/tclEnsemble.c | 2 | ||||
| -rw-r--r-- | generic/tclListObj.c | 14 | ||||
| -rw-r--r-- | generic/tclStringObj.c | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index bd68078..6811849 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3149,7 +3149,7 @@ TclCompileEnsemble( * any extra elements that might have been appended by failing * pathways above. */ - (void) Tcl_ListObjReplace(NULL, replaced, depth-1, INT_MAX, 0, NULL); + (void) Tcl_ListObjReplace(NULL, replaced, depth-1, LIST_MAX, 0, NULL); /* * TODO: Reconsider whether we ought to call CompileToInvokedCommand() diff --git a/generic/tclListObj.c b/generic/tclListObj.c index e2e0f63..603b828 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -935,18 +935,18 @@ Tcl_ListObjReplace( } if (count < 0) { count = 0; - } else if (numElems < first+count || first+count < 0) { - /* - * The 'first+count < 0' condition here guards agains integer - * overflow in determining 'first+count'. - */ + } else if (first > INT_MAX - count /* Handle integer overflow */ + || numElems < first+count) { count = numElems - first; } if (objc > LIST_MAX - (numElems - count)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "max length of a Tcl list (%d elements) exceeded", LIST_MAX)); + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "max length of a Tcl list (%d elements) exceeded", + LIST_MAX)); + } return TCL_ERROR; } isShared = (listRepPtr->refCount > 1); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 61ff2fc..85b15fd 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2656,7 +2656,7 @@ TclStringCatObjv( /* Value has a string rep. */ if (objPtr->length) { /* - * Non-empty string rep. Not a pure bytearray, so we + * Non-empty string rep. Not a pure bytearray, so we * won't create a pure bytearray */ binary = 0; @@ -2753,7 +2753,7 @@ TclStringCatObjv( if (inPlace && !Tcl_IsShared(*objv)) { int start; - + objResultPtr = *objv++; objc--; Tcl_GetByteArrayFromObj(objResultPtr, &start); dst = Tcl_SetByteArrayLength(objResultPtr, length) + start; |
