RFR (s) 8225397 : Integer value miscalculation in toString() method of BitSet

Ivan Gerasimov ivan.gerasimov at oracle.com
Thu Jun 6 09:18:31 UTC 2019


Hello!

It is yet another instance of integer overflow under certain extreme 
circumstances.

This time it is when calculating the initial capacity of a StringBuilder 
in BitSet.toString.

If there are too many elements in the set, we can't do much anyway.

The best effort is to avoid confusing NegativeArraySizeException and let 
the method throw OOM.

Would you please help review the fix?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8225397
WEBREV: http://cr.openjdk.java.net/~igerasim/8225397/00/webrev/

-- 
With kind regards,
Ivan Gerasimov



More information about the core-libs-dev mailing list