On Fri, 25 Sep 2026 20:21:07 GMT, David Carlier <[email protected]> wrote:
>> https://bugs.openjdk.org/browse/JDK-8392782 >> >> --------- >> - [X] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > test/jdk/sun/security/util/BitArray/BitArrayIntegerOverflow.java line 40: > >> 38: public static void main(String[] args) { >> 39: assertThrows(OutOfMemoryError.class, >> 40: () -> new BitArray(Integer.MAX_VALUE - 6)); > > would it be useful to exercise the `BitArray(int length, byte[] a, int ofs)` > codepath too ? Both constructors use the same `byteLen(length)` calculation, so the overflow-prone arithmetic is already covered by the BitArray(int) test. Exercising `BitArray(int, byte[], int)` at this boundary would require an input array of about 256 MiB and allocate another 256 MiB for the copy —roughly 512 MiB before JVM overhead. I don't think an additional test is necessary for the same shared calculation. Thanks for pointing this out; others are probably wondering the same thing. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/33072#discussion_r4135073499
