RFR: 8286378: Address possibly lossy conversions in java.base [v3]
Roger Riggs
rriggs at openjdk.java.net
Fri May 13 14:22:01 UTC 2022
On Fri, 13 May 2022 05:54:15 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> src/java.base/linux/classes/sun/nio/ch/EPollSelectorImpl.java line 128:
>>
>>> 126: // timed poll interrupted so need to adjust timeout
>>> 127: long adjust = System.nanoTime() - startTime;
>>> 128: to =- (int) TimeUnit.NANOSECONDS.toMillis(adjust);
>>
>> This will now always assign a negative number to `to`.
>>
>> --------------------------------------------------------------------------------
>>
>> `=-` is not a compound assignment, it’s negation followed by a normal assignment.
>
> Well spotted, I don't think that change was intentionally.
Ouch; Will fix:
I took Alan's earlier comment literally:
"This one can also be changed to:
to =- (int) TimeUnit.NANOSECONDS.toMillis(adjust);"
-------------
PR: https://git.openjdk.java.net/jdk/pull/8642
More information about the security-dev
mailing list