diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2003-05-14 23:01:55 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2003-05-14 23:01:55 (GMT) |
commit | 9b9b51c2fab5fd17f252834c55be6dfbbc1c286a (patch) | |
tree | cb32e64731eef59ecc4e9b6f2854dc5dd4e170cf /generic | |
parent | 750c72292478ff1c587134fe363497ff9c006a5d (diff) | |
download | tcl-9b9b51c2fab5fd17f252834c55be6dfbbc1c286a.zip tcl-9b9b51c2fab5fd17f252834c55be6dfbbc1c286a.tar.gz tcl-9b9b51c2fab5fd17f252834c55be6dfbbc1c286a.tar.bz2 |
Consequent fixes from [Bug 699060]; [format] should not be too eager to demote
wides to ints, and should throw errors when appropriate.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdAH.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 596795a..2e6ba99 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.5 2003/04/16 23:31:42 dgp Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.6 2003/05/14 23:01:56 dkf Exp $ */ #include "tclInt.h" @@ -2203,7 +2203,14 @@ Tcl_FormatObjCmd(dummy, interp, objc, objv) break; } else { whichValue = INT_VALUE; - intValue = (int) Tcl_WideAsLong(wideValue); + if (wideValue>ULONG_MAX || wideValue<LONG_MIN) { + /* + * Value too big for type. Generate an error. + */ + Tcl_GetLongFromObj(interp, objv[objIndex], &intValue); + goto fmtError; + } + intValue = Tcl_WideAsLong(wideValue); } } else if (objv[objIndex]->typePtr == &tclIntType) { Tcl_GetLongFromObj(NULL, objv[objIndex], &intValue); |