[9] RFR(XS): 8076625: IndexOutOfBoundsException in HeapByteBufferTest.java

Tobias Hartmann tobias.hartmann at oracle.com
Mon Apr 13 04:51:06 UTC 2015


Thanks, Vladimir.

Best,
Tobias

On 10.04.2015 17:17, Vladimir Kozlov wrote:
> Looks good.
> 
> Thanks,
> Vladimir
> 
> On 4/10/15 3:42 AM, Tobias Hartmann wrote:
>> Hi Vladimir,
>>
>> On 09.04.2015 18:22, Vladimir Kozlov wrote:
>>> I also asked to use Utils::getRandomInstance() to get reproducible results.
>>
>> Sorry, I missed that. Here is the new webrev:
>>
>> http://cr.openjdk.java.net/~thartmann/8076625/webrev.01/
>>
>> I also noticed that the sizes of short and char reads passed to 'randomOffset' are too large (4 instead of 2). Fixed it.
>>
>> Best,
>> Tobias
>>
>>
>>> Thanks,
>>> Vladimir
>>>
>>>
>>> On 4/9/15 5:10 AM, Tobias Hartmann wrote:
>>>> Hi,
>>>>
>>>> please review the following patch.
>>>>
>>>> https://bugs.openjdk.java.net/browse/JDK-8076625
>>>> http://cr.openjdk.java.net/~thartmann/8076625/webrev.00/
>>>>
>>>> Problem:
>>>> A random offset to access in a byte array is computed by
>>>>
>>>>     int randomOffset(SplittableRandom r, MyByteBuffer buf, int size) {
>>>>       return abs(r.nextInt()) % (buf.capacity() - size);
>>>>     }
>>>>
>>>> The call to r.nextInt() may return Integer.MIN_VALUE (-2147483648) and the corresponding absolute value (+2147483648) does not fit into an int and will overflow back to -2147483648. As a result the returned offset is negative.
>>>>
>>>> Solution:
>>>> Use nextInt(int n) to set the limit of the random value.
>>>>
>>>> Testing:
>>>> Failing testcase and JPRT.
>>>>
>>>> Thanks,
>>>> Tobias
>>>>


More information about the hotspot-compiler-dev mailing list