(Integer-)Overflow in SysUtils.TimeStampToMSecs
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
In rtl/objpas/sysutils/dati.inc:
|function TimeStampToMSecs (const TimeStamp: TTimeStamp): comp;
|begin
| result := TimeStamp.Time + timestamp.date*msecsperday;
|end ;
the expression "timestamp.date*msecsperday" results in an arithmetic overflow (at least on i386 targets), because it is handled as Integer [32Bit only(?)], while the result really is a Comp [64bit].
Suggested fix:
Typecast Time_Stamp.Date in the expression above to Comp before:
Comp(TimeStamp.Date) * MSecsPerDay
to evaluate the expression in 64-Bit range.
Additional information:
Reporter: Vinzent Hoefler
EMail: JeLlyFish dot software at gmx dot net
Mantis conversion info:
- Mantis ID: 5875
- OS: Win32
- Version: 1.9.8
- Fixed in version: 2.0.2