Hi,

In HttpUrlConnection, if the chunk length is set to Integer.MAX_VALUE, our code was trying to initialize a buffer of size greater than that, which was resulting in an integer overflow, and consequently a NegativeArraySizeException. This fix ensures that while initializing the internal buffer, we never exceed the maximum size of the chunk length fixed by the user,
and hence avert the NegativeArraySizeException.

I have added a test to cover the case. The test will however try to create a buffer of size Integer.MAX_VALUE. I could change the value of the JVM heap, but the required size (~2 GB) will be too large for most machines to support.
However, I am open to advice as to what I should do in this case.

Bug: http://bugs.sun.com/view_bug.do?bug_id=8015421
Webrev: http://cr.openjdk.java.net/~khazra/8015421/webrev.00/



Thanks,
Kurchi

Reply via email to