Tcl Source Code

View Ticket
Login
Ticket UUID: 3e8074aea74539cfd981ad6912c52c1488fc89c4
Title: [interp limit time -seconds] has a y2k38 problem
Type: Bug Created on: 2023-01-12 17:07:02
Submitter: max Assigned to: jan.nijtmans
Subsystem: 20. [interp] Severity: Minor
Priority: 5 Medium Last modified: 2023-01-27 21:49:28
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2023-01-27 21:49:28
Version: 8.6.13
Description:
% set i [interp create]
interp0
% $i limit time -seconds [expr {2**31-1}]
% $i limit time -seconds [expr {2**31}]
seconds must be at least 0
% $i limit time -seconds [expr {2**32}]
integer value too large to represent as non-long integer

This breaks several of the interp-34.* tests that use interp limit time -seconds when run on a system whose time is past clock format [expr {2**31-1}].

A quick look at the code in tclInterp.c showed that ChildTimeLimitCmd() parses the argument to the -seconds switch using TclGetIntFromObj() where TclGetLongFromObj() or even TclGetWideIntFromObj() (like [clock format]) seems more appropriate to match up with the rest of time handling in Tcl, which doesn't have a y2k38 problem in general.

User Comments:
jan.nijtmans added on 2023-01-19 21:41:15:

Proposed fix [504171c4e4b8f1e7|here]


jan.nijtmans added on 2023-01-27 21:49:28:

Fix is now merged to core-8-6-branch (higher branches already had this fixed)

So, closing.