RFR 8214124: [TESTBUG] Bugs in runtime/NMT/MallocStressTest.java

Zhengyu Gu zgu at redhat.com
Tue Nov 20 16:48:22 UTC 2018


This test assumes Math.abs(random.nextInt()) >= 0, but it is *not* 
always true, as Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE, which 
is a negative value [1].

The first instance could result miscounting of allocation size and the 
second one could result index OOB.

Bug: https://bugs.openjdk.java.net/browse/JDK-8214124
Webrev: http://cr.openjdk.java.net/~zgu/8214124/webrev.00/


[1] https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#abs(int)

Thanks,

-Zhengyu


More information about the hotspot-runtime-dev mailing list