openjdk8 update 8u232-b09-0ubuntu1~18.04.1 breaks Timestamp values for timezones that change DST observance

Bug #1859217 reported by Eugen Stoianovici
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
openjdk-8 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

The testcase showing the issue:

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class TZTest {
    public static void main(String args[]) {
        TimeZone tz = TimeZone.getTimeZone("Europe/Istanbul");
        TimeZone.setDefault(tz);
        GregorianCalendar gc = new GregorianCalendar(1943, 00, 01, 12, 01, 01);
        gc.add(Calendar.MILLISECOND, 123);
        System.out.println(System.getProperty("java.version") + "->" + gc.getTimeInMillis());
    }
}

The output for 1.8 and 11.0 is:
1.8.0_232->-852044338877
11.0.5 ->-852040738877

note that there is one hour worth of difference between the two values. The value reported in 11.0.5 is the correct one (or, at least, the one that is compatible with all other jdk versions). You have to compile and execute the code with the same version for the issue to happen, i.e. compile with 1.8 and execute with 1.8 and then compile with 11 and execute with 11

As far as I know, Europe/Instanbul kept changing the DST observance rules. GregorianCalendar::getTimeInMillis() seems to be broken around all the changes I've tested with:

1943-01-01 12:01:01.123
1963-01-01 12:01:01.123
1979-01-01 12:01:01.123
1985-01-01 12:01:01.123

The upgrade happened on the 18th of December:
Start-Date: 2019-12-18 06:16:01
Commandline: /usr/bin/unattended-upgrade
Upgrade: openjdk-8-jdk-headless:amd64 (8u222-b10-1ubuntu1~18.04.1, 8u232-b09-0ubuntu1~18.04.1), openjdk-8-jre-headless:amd64 (8u222-b10-1ubuntu1~18.04.1, 8u232-b09-0ubuntu1~18.04.1)
End-Date: 2019-12-18 06:16:23

Applications using this patch will observe wrong data with unknown consequences.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: openjdk-8-jdk 8u232-b09-0ubuntu1~18.04.1
ProcVersionSignature: Ubuntu 4.15.0-1065.75-oem 4.15.18
Uname: Linux 4.15.0-1065-oem x86_64
NonfreeKernelModules: lkp_Ubuntu_4_15_0_1065_75_oem_61 nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.9
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Fri Jan 10 16:53:07 2020
InstallationDate: Installed on 2019-12-18 (23 days ago)
InstallationMedia: Ubuntu 18.04 "Bionic" - Build amd64 LIVE Binary 20180608-09:38
ProcEnviron:
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_IE.UTF-8
 SHELL=/bin/bash
SourcePackage: openjdk-8
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Eugen Stoianovici (estoianovici) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjdk-8 (Ubuntu):
status: New → Confirmed
tags: added: regression-security
Revision history for this message
Tiago Stürmer Daitx (tdaitx) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

The changes come from the update to tzdata2019c [1] which was done at a later time in OpenJDK 11 - in fact the newer OpenJDK 11.0.6 reports the same results as OpenJDK 8u232. OpenJDK 11.0.6 is available in focal-proposed as of now and will available in supported Ubuntu releases soon.

The announcement for tzdata2019c [2] does state that past timestamps for Turkey changed and the OpenJDK commit [1] has the references to the changes.

To check if OpenJDK itself was somehow incorrectly interpreting the data I also run the following using 'date' which uses the system's timezone data (also sourced from tzdata2019c). Results matches the OpenJDK output:

$ date --date='TZ="Europe/Istanbul" 1943-01-01 12:01:01' '+%s'
-852044339

Please note that date is limited to 'seconds' precision for the epoch.

If that is somehow wrong, it should be brought to the attention of the maintainers of tzdata through the <email address hidden> mailing list as stated in [3].

I'm closing this bug now.

References:
[1] https://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/8560bc534080#l4.130
[2] https://mm.icann.org/pipermail/tz-announce/2019-September/000057.html
[3] https://www.iana.org/time-zones

Changed in openjdk-8 (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.