simon-git: agedu (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Oct 12 16:05:37 BST 2024
TL;DR:
3622eda Fix infinite loop in round_and_format_age.
Repository: https://git.tartarus.org/simon/agedu.git
On the web: https://git.tartarus.org/?p=simon/agedu.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2024-10-12 16:05:37
commit 3622edabe7f6776dc66dd5d685ab9980226cfa6b
web diff https://git.tartarus.org/?p=simon/agedu.git;a=commitdiff;h=3622edabe7f6776dc66dd5d685ab9980226cfa6b;hp=8cd63c5778d2e2872d951b775292ee8025bdcca4
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Oct 12 16:01:46 2024 +0100
Fix infinite loop in round_and_format_age.
This occurs if an atime in agedu's index has value zero, or close to
it. I found it while manually constructing an agedu dump file from
other data: I accidentally set _all_ the atime fields to zero.
round_and_format_age works by making 'struct tm' more and more years
in the past until it finds one earlier than the given input value, but
stores the results in an unsigned long long (that being the format of
atimes in the dump file). When the test 'struct tm' had the year 1970,
it was still newer than time zero; when it had 1969, mktime returned a
negative time_t, which turned into a huge one, which _still_ compared
greater than the target time.
Now we spot the case where unsigned integer underflow has occurred,
and use it as another reason to terminate the loop.
html.c | 2 ++
1 file changed, 2 insertions(+)
More information about the tartarus-commits
mailing list