diff options
Diffstat (limited to 'generic/tclResult.c')
-rw-r--r-- | generic/tclResult.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c index 273416d..3c329f1 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.57 2010/02/24 10:45:04 dkf Exp $ + * RCS: @(#) $Id: tclResult.c,v 1.58 2010/03/24 15:33:14 dgp Exp $ */ #include "tclInt.h" @@ -1425,6 +1425,28 @@ 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); + Tcl_SetErrorCode(interp, "TCL", "RESULT", "ILLEGAL_ERRORCODE", + NULL); + goto error; + } + } + + /* * Convert [return -code return -level X] to [return -code ok -level X+1] */ |