diff options
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r-- | generic/tclClock.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index af88334..12c2e64 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclClock.c,v 1.65 2008/02/27 00:12:25 das Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.66 2008/02/27 02:08:27 kennykb Exp $ */ #include "tclInt.h" @@ -65,6 +65,7 @@ typedef enum ClockLiteral { LIT_CE, LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, LIT_ERA, LIT_GMT, LIT_GREGORIAN, + LIT_INTEGER_VALUE_TOO_LARGE, LIT_ISO8601WEEK, LIT_ISO8601YEAR, LIT_JULIANDAY, LIT_LOCALSECONDS, LIT_MONTH, @@ -80,6 +81,7 @@ static const char *const literals[] = { "CE", "dayOfMonth", "dayOfWeek", "dayOfYear", "era", ":GMT", "gregorian", + "integer value too large to represent", "iso8601Week", "iso8601Year", "julianDay", "localSeconds", "month", @@ -417,6 +419,16 @@ ClockGetdatefieldsObjCmd( return TCL_ERROR; } + /* + * fields.seconds could be an unsigned number that overflowed. Make + * sure that it isn't. + */ + + if (objv[1]->typePtr == &tclBignumType) { + Tcl_SetObjResult(interp, literals[LIT_INTEGER_VALUE_TOO_LARGE]); + return TCL_ERROR; + } + /* * Convert UTC time to local. */ |