diff options
author | dkf <dkf@noemail.net> | 2003-05-14 23:01:54 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2003-05-14 23:01:54 (GMT) |
commit | 04c86c63424e47ebce34d993d608c7054ac81db8 (patch) | |
tree | cb32e64731eef59ecc4e9b6f2854dc5dd4e170cf /generic | |
parent | 21fcfc49f00176b88bf12cd169c074c13ee78d38 (diff) | |
download | tcl-04c86c63424e47ebce34d993d608c7054ac81db8.zip tcl-04c86c63424e47ebce34d993d608c7054ac81db8.tar.gz tcl-04c86c63424e47ebce34d993d608c7054ac81db8.tar.bz2 |
Consequent fixes from [Bug 699060]; [format] should not be too eager to demote
wides to ints, and should throw errors when appropriate.
FossilOrigin-Name: 8630c78e33138662b36b68640d8adb20252b7d1c
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); |