diff options
author | dgp <dgp@users.sourceforge.net> | 2015-11-20 15:47:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2015-11-20 15:47:30 (GMT) |
commit | c32d032cbd7947d9e64e931df87fc4f374d81e7f (patch) | |
tree | 7e02359071b911f8968e3f97fa77946c51e03d45 /generic | |
parent | 5498d8aaa43327e94fd652a66fde74f4187452db (diff) | |
download | tcl-c32d032cbd7947d9e64e931df87fc4f374d81e7f.zip tcl-c32d032cbd7947d9e64e931df87fc4f374d81e7f.tar.gz tcl-c32d032cbd7947d9e64e931df87fc4f374d81e7f.tar.bz2 |
[40f628e8e3] Tcl_ListObjReplace() callers need to handle TCL_ERROR.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdIL.c | 10 | ||||
-rw-r--r-- | generic/tclUtil.c | 8 |
2 files changed, 15 insertions, 3 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index ea9c1e4..02e5812 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2233,7 +2233,10 @@ Tcl_LinsertObjCmd( Tcl_ListObjAppendElement(NULL, listPtr, objv[3]); } else { - Tcl_ListObjReplace(NULL, listPtr, index, 0, (objc-3), &(objv[3])); + if (TCL_OK != Tcl_ListObjReplace(interp, listPtr, index, 0, + (objc-3), &(objv[3]))) { + return TCL_ERROR; + } } /* @@ -2598,7 +2601,10 @@ Tcl_LreplaceObjCmd( * optimize this case away. */ - Tcl_ListObjReplace(NULL, listPtr, first, numToDelete, objc-4, &(objv[4])); + if (TCL_OK != Tcl_ListObjReplace(interp, listPtr, first, numToDelete, + objc-4, &(objv[4]))) { + return TCL_ERROR; + } /* * Set the interpreter's object result. diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 69d0b17..bc1490e 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1791,7 +1791,12 @@ Tcl_ConcatObj( TclListObjGetElements(NULL, objPtr, &listc, &listv); if (listc) { if (resPtr) { - Tcl_ListObjReplace(NULL, resPtr, INT_MAX, 0, listc, listv); + if (TCL_OK != Tcl_ListObjReplace(NULL, resPtr, + INT_MAX, 0, listc, listv)) { + /* Abandon ship! */ + Tcl_DecrRefCount(resPtr); + goto slow; + } } else { resPtr = TclListObjCopy(NULL, objPtr); } @@ -1808,6 +1813,7 @@ Tcl_ConcatObj( * the slow way, using the string representations. */ + slow: /* First try to pre-allocate the size required */ for (i = 0; i < objc; i++) { element = TclGetStringFromObj(objv[i], &elemLength); |