Integer overflow in 'mktime' when checking leap year.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Sep 2026 08:40:54 UTC
Will there not be an overflow if 'tm_year' is one of [INT_MAX-1899, INT_MAX] when checking if the 'tm_year' is a leap year. In glibc they avoid adding 1900 to the 'tm_year' when doing this check in order to avoid overflowing 'tm_year'. I didn't look into details of how 'mktime' is implemented on FreeBSD so I might be wrong, but just skimming through, the overflow in 'tm_year' seems obvious? -- Jure