develooper Front page | perl.perl5.porters | Postings from May 2016

[perl #128167] Issues with the embedded y2038 library

Thread Next
From:
R . Diez
Date:
May 17, 2016 13:46
Subject:
[perl #128167] Issues with the embedded y2038 library
Message ID:
rt-4.0.18-6224-1463491866-1588.128167-75-0@perl.org
# New Ticket Created by  R. Diez 
# Please include the string:  [perl #128167]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128167 >


The Perl interpreter embeds a copy of Schwern's y2038 library, see file time64.c here:

  http://perl5.git.perl.org/perl.git/blob/HEAD:/time64.c

I reported a few issues with this library, see this pull request of mine:

  "Amendments to y2038"
  https://github.com/evalEmpire/y2038/pull/9

However, Schwern is not responding anymore.

>From that pull request, 2 particular issues stand out:

Issue 1) Array indexing with the result of a boolean C comparison.

This is dangerous because (as far as I know) the C standard does not guarantee that the inteeger result of a comparison always 0 or 1 is.

In this particular case, simplified:

  #define IS_LEAP(n)      (blah_blah != 0)

  days += length_of_year[IS_LEAP(year)];

Issue 2) One of the date unit test cases fails.

This makes me worry that the date/time calculations may fail at some point in time in the future.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About