diff options
author | dgp <dgp@users.sourceforge.net> | 2010-03-24 15:31:47 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2010-03-24 15:31:47 (GMT) |
commit | 266cbf7893cc320f3f90cf8b32771d6dc35c1e55 (patch) | |
tree | e35f7fbdcbeefd2d46ec87a195405c4187d5d740 /generic | |
parent | 5e00bffa49c109621360b8e8428cacc4162987aa (diff) | |
download | tcl-266cbf7893cc320f3f90cf8b32771d6dc35c1e55.zip tcl-266cbf7893cc320f3f90cf8b32771d6dc35c1e55.tar.gz tcl-266cbf7893cc320f3f90cf8b32771d6dc35c1e55.tar.bz2 |
* generic/tclResult.c: [Bug 2383005] Revise [return -errorcode] so
* tests/result.test: that it rejects illegal non-list values.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclResult.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c index 054ba9d..c461387 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclResult.c,v 1.47 2008/03/07 22:42:49 andreas_kupries Exp $ + * RCS: @(#) $Id: tclResult.c,v 1.47.2.1 2010/03/24 15:31:48 dgp Exp $ */ #include "tclInt.h" @@ -1379,6 +1379,26 @@ TclMergeReturnOptions( } /* + * Check for bogus -errorcode value. + */ + + Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORCODE], &valuePtr); + if (valuePtr != NULL) { + int length; + + if (TCL_ERROR == Tcl_ListObjLength(NULL, valuePtr, &length )) { + /* + * Value is not a list, which is illegal for -errorcode. + */ + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "bad -errorcode value: " + "expected a list but got \"", + TclGetString(valuePtr), "\"", NULL); + goto error; + } + } + + /* * Convert [return -code return -level X] to [return -code ok -level X+1] */ |