Skip to content
Tcl Source Code View Ticket
Login

View Ticket

signed integer overflow in TclpGetClicks()

Closed / Fixedfb4a0a66752423622d38c070f89ad81e3b4c2bb8Created 5 years agoUpdated 5 years ago
Descriptionwiki2022-02-17 00:55:29
Except for maybe 35 minutes before and after the epoch, there is always signed integer overflow in TclpGetClicks() implementations when long is 32-bit:
% clock clicks
tcl/unix/tclUnixTime.c:152:19: runtime error: signed integer overflow: 1645057584 * 1000000 cannot be represented in type 'long int'
3505507099

The attached patch should avoid this, however I have only tested the case for Unix with gettimeofday(), and not the cases for Unix without gettimeofday() nor Windows without NativeGetMicroseconds().

Referenced by1
chrstphrchvz Ticket [fb4a0a6675]: 3 changes [History diff]2022-02-17 00:58:35
jan.nijtmanswiki2022-02-23 14:16:29

Fixed [here]

Thanks for the report and the patch!

Log in (anonymous is fine) to add a comment.