Hello,

I'm thinking to try to address bug 63894 (grub_datetime2unixtime()
still has the year 2038 problem):
https://savannah.gnu.org/bugs/?63894

I confirmed the issue is still partially present in
include/grub/datetime.h... the following checks are still present and
the issue mentioned local variable limitations are also still an
issue:

grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int64_t *nix)
{
  grub_int32_t ret;
...
  if (datetime->year > 2038 || datetime->year < 1901)
    return 0;
...

Simply changing the locals to 64-bit and removing the 2038 limit does
not completely solve the issue, at some point past 2038 the result of
this algorithm produces incorrect results.

To completely solve the issue, I wanted to use the algorithm
implemented by the Linux kernel in mktime64 (time.c around line 449):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/time/time.c?h=v6.11-rc3

Would it be acceptable to base the GRUB implementation on the Linux
Kernel algorithm above?

Thanks,
Andrew

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to