]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Fix a Y2038 bug by replacing `Int32x32To64` with regular multiplication (#2471)
authorSilent <CookiePLMonster@users.noreply.github.com>
Wed, 1 Jan 2025 16:31:35 +0000 (17:31 +0100)
committerMartin Matuska <martin@matuska.de>
Tue, 11 Mar 2025 09:31:35 +0000 (10:31 +0100)
commitda4d94275107cbc17b427e3e340797abed8c25b6
treeb7e4645024348fe9e795e0d620f561d43cfae539
parent7d301761a07683ce8eccf552f750c440b6c6a9c5
Fix a Y2038 bug by replacing `Int32x32To64` with regular multiplication (#2471)

`Int32x32To64` macro internally truncates the arguments to int32, while
`time_t` is 64-bit on most/all modern platforms. Therefore, usage of
this macro creates a Year 2038 bug.

I detailed this issue a while ago in a writeup, and spotted the same
issue in this repository when updating the list of affected
repositories:
<https://cookieplmonster.github.io/2022/02/17/year-2038-problem/>

A few more notes:
1. I changed all uses of `Int32x32To64` en masse, even though at least
one of them was technically OK and used with int32 parameters only. IMO
better safe than sorry.
2. This is untested, but it's a small enough change that I hope the CI
success is a good enough indicator.

(cherry picked from commit 14b8803c40d36fe1f0c8b3bb2846d865e3adcfce)
cpio/cpio_windows.c
libarchive/archive_write_disk_windows.c
test_utils/test_main.c