summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--generic/tclClock.c22
-rw-r--r--tests/clock.test10
3 files changed, 33 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index e79000e..70686ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-06-17 Kevin Kenny <kennykb@acm.org>
+
+ * generic/tclClock.c (ConvertLocalToUTC):
+ * tests/clock.test (clock-63.1): Fixed a bug where the
+ internal ConvertLocalToUTC command segfaulted if passed a
+ dictionary without the 'localSeconds' key. To the best of
+ my knowledge, the bug was not observable in the [clock]
+ command itself.
+
2008-06-16 Andreas Kupries <andreask@activestate.com>
* generic/tclCmdIL.c (TclInfoFrame): Backport of fix made on the
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 12c2e64..53edf55 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.66 2008/02/27 02:08:27 kennykb Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.66.2.1 2008/06/17 02:22:26 kennykb Exp $
*/
#include "tclInt.h"
@@ -333,12 +333,20 @@ ClockConvertlocaltoutcObjCmd(
return TCL_ERROR;
}
dict = objv[1];
- if ((Tcl_DictObjGet(interp, dict, literals[LIT_LOCALSECONDS],
- &secondsObj) != TCL_OK)
- || (Tcl_GetWideIntFromObj(interp, secondsObj,
- &(fields.localSeconds)) != TCL_OK)
- || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK)
- || ConvertLocalToUTC(interp, &fields, objv[2], changeover)) {
+ if (Tcl_DictObjGet(interp, dict, literals[LIT_LOCALSECONDS],
+ &secondsObj)!= TCL_OK) {
+ fprintf(stderr, "fell out here\n"); fflush(stderr);
+ return TCL_ERROR;
+ }
+ if (secondsObj == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("key \"localseconds\" not "
+ "found in dictionary", -1));
+ return TCL_ERROR;
+ }
+ if ((Tcl_GetWideIntFromObj(interp, secondsObj,
+ &(fields.localSeconds)) != TCL_OK)
+ || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK)
+ || ConvertLocalToUTC(interp, &fields, objv[2], changeover)) {
return TCL_ERROR;
}
diff --git a/tests/clock.test b/tests/clock.test
index e3b3f85..cb7c4a1 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -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: clock.test,v 1.83.2.1 2008/04/14 18:04:40 kennykb Exp $
+# RCS: @(#) $Id: clock.test,v 1.83.2.2 2008/06/17 02:22:26 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -36636,6 +36636,14 @@ test clock-62.1 {Bug 1902423} {*}{
-result ok
}
+test clock-63.1 {Incorrect use of internal ConvertLocalToUTC command} {*}{
+ -body {
+ ::tcl::clock::ConvertLocalToUTC {immaterial stuff} {} 12345
+ }
+ -returnCodes error
+ -result {key "localseconds" not found in dictionary}
+}
+
# cleanup
namespace delete ::testClock