diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-18 12:12:48 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-18 12:12:48 (GMT) |
commit | f4d2128af7d54bbd23cc5fe49e7042d83a6cb12f (patch) | |
tree | af3e00a7424ef1a7b621dc73df3eec12563ae191 /generic/tclInterp.c | |
parent | 0d15664cbdafeb59a53986a6e646b79f7e5124da (diff) | |
parent | 345894cae91f9e72bbbfd6264ab98a2263d9dd1b (diff) | |
download | tcl-f4d2128af7d54bbd23cc5fe49e7042d83a6cb12f.zip tcl-f4d2128af7d54bbd23cc5fe49e7042d83a6cb12f.tar.gz tcl-f4d2128af7d54bbd23cc5fe49e7042d83a6cb12f.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tclInterp.c')
-rw-r--r-- | generic/tclInterp.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index c9111d2..e1979e0 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -4796,7 +4796,7 @@ ChildTimeLimitCmd( Tcl_Obj *milliObj = NULL, *secObj = NULL; int gran = 0; Tcl_Time limitMoment; - int tmp; + Tcl_WideInt tmp; Tcl_LimitGetTime(childInterp, &limitMoment); for (i=consumedObjc ; i<objc ; i+=2) { @@ -4828,17 +4828,17 @@ ChildTimeLimitCmd( if (milliLen == 0) { break; } - if (TclGetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) { + if (TclGetWideIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) { return TCL_ERROR; } - if (tmp < 0) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "milliseconds must be at least 0", -1)); + if (tmp < 0 || tmp > LONG_MAX) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "milliseconds must be between 0 and %ld", LONG_MAX)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "BADVALUE", NULL); return TCL_ERROR; } - limitMoment.usec = ((long) tmp)*1000; + limitMoment.usec = ((long)tmp)*1000; break; case OPT_SEC: secObj = objv[i+1]; @@ -4846,17 +4846,17 @@ ChildTimeLimitCmd( if (secLen == 0) { break; } - if (TclGetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) { + if (TclGetWideIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) { return TCL_ERROR; } - if (tmp < 0) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "seconds must be at least 0", -1)); + if (tmp < 0 || tmp > LONG_MAX) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "seconds must be between 0 and %ld", LONG_MAX)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "BADVALUE", NULL); return TCL_ERROR; } - limitMoment.sec = tmp; + limitMoment.sec = (long)tmp; break; } } |