]> git.ipfire.org Git - thirdparty/tar.git/commit
Fix unlikely problems with time overflow
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Aug 2024 17:02:06 +0000 (10:02 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Aug 2024 08:41:43 +0000 (01:41 -0700)
commit6c91bd82e1001a72ffd2e7dd3a2ce1668a513247
treeaa5dd2f588f6a204bda647a73219656ddb9385ca
parentaae99e863d3c59cbad4703e678045b13984dda35
Fix unlikely problems with time overflow

Also, fix some rounding errors while we’re in the neighborhood.
* src/buffer.c (duration_ns, compute_duration_ns): Rename from
‘duration’ and ‘compute_duration’, and count ns rather than s, to
lessen rounding error.  All uses changed.
(compute_duration_ns): Work even if the clock moves backward
and time_t is unsigned.
(print_stats): Don’t worry about null or empty TEXT, as that
cannot happen.  Compare double to UINTMAX_MAX + 1.0, not
to UINTMAX_MAX, so that the comparison is exact.
Handle the unlikely case that numbytes >= UINTMAX_MAX.
* src/tar.c (parse_opt): Treat -L hugenumber as effectively
infinity rather than erroring out.
Prefer ckd_add to checking overflow by hand.
src/buffer.c
src/checkpoint.c
src/common.h
src/tar.c