summaryrefslogtreecommitdiffstats
path: root/generic/tclClock.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2008-02-27 02:08:23 (GMT)
committerKevin B Kenny <kennykb@acm.org>2008-02-27 02:08:23 (GMT)
commitbd73b8d2cd6de4ced39064b2c152e692c2ebe342 (patch)
tree6b2e7fe61cec45eb7e135a8d0a03c2ed79792b72 /generic/tclClock.c
parentc1320be6a02548d913477b41e87c5227fa57b5b8 (diff)
downloadtcl-bd73b8d2cd6de4ced39064b2c152e692c2ebe342.zip
tcl-bd73b8d2cd6de4ced39064b2c152e692c2ebe342.tar.gz
tcl-bd73b8d2cd6de4ced39064b2c152e692c2ebe342.tar.bz2
* doc/clock.n: Corrected minor indentation gaffe in the
penultimate paragraph. [Bug 1898025] * generic/tclClock.c (ParseClockFormatArgs): Changed to check that the clock value is in the range of a 64-bit integer. [Bug 1862555] * library/clock.tcl (::tcl::clock::format, ::tcl::clock::scan, ::tcl::clock::add, ::tcl::clock::LocalizeFormat): Fixed bugs in caching of localized strings that caused weird results when localized date/time formats were used. [Bug 1902423] * tests/clock.test (clock-61.*, clock-62.1): Regression tests for [Bug 1862555] and [Bug 1902423].
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r--generic/tclClock.c14
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.
*/