RFR 9: 8133022: Instant.toEpochMilli() silently overflows

Ivan Gerasimov ivan.gerasimov at oracle.com
Thu Aug 6 16:34:31 UTC 2015


Hi Roger!

There seems to be another numeric overflow possibility a the line# 1235, 
when 'seconds' is a large negative and 'nanos' is a small positive.

For example,
------------
         Instant inst = Instant.ofEpochSecond(-9223372036854776L, 1);
         System.out.println(inst.toEpochMilli());
------------
prints out 9223372036854775616.


Sincerely yours,
Ivan

On 06.08.2015 18:33, Roger Riggs wrote:
> Please review a small fix and test for Instant.toEpochMilli 
> ArithmeticOverflow.
>
> Webrev:
>    http://cr.openjdk.java.net/~rriggs/webrev-overflow-8133022/
>
> Issue:
>     https://bugs.openjdk.java.net/browse/JDK-8133022
>
> Thanks, Roger
>
>
>
>
>




More information about the core-libs-dev mailing list