JDK 9 RFR of JDK-8067289 (XS): Fix deprecation warnings in java.base module - CRC32C
Remi Forax
forax at univ-mlv.fr
Thu Dec 11 20:09:51 UTC 2014
At the same time, if you have an overflow here, it means that you are
able to create an int array (a int[]) with a size which is greater than
2G (minus the offset).
Rémi
On 12/11/2014 08:23 PM, joe darcy wrote:
> Hi Staffan,
>
> I haven't examined the code for possible integer overflow cases, but
> it would be fundamentally safer if the values were promoted to long
> *before* the arithmetic rather than after. In other words, instead of
>
> (long)(Unsafe.ARRAY_BYTE_BASE_OFFSET + off) // Overflow
> theoretically possible
>
> use
>
> (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off // No overflow worries
> with int inputs
>
> -Joe
>
> On 12/11/2014 11:19 AM, Staffan Friberg wrote:
>> Hi,
>>
>> Here is a small fix that avoids calling deprecated sun.misc.Unsafe
>> methods, which allows the @SuppressWarnings to be removed.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8067289
>> Webrev: http://cr.openjdk.java.net/~sfriberg/JDK-8067289/webrev.00
>>
>> Regards,
>> Staffan
>
More information about the core-libs-dev
mailing list