RFR  BufferedInputStream calculates negative array size with large streams and mark
ivan.gerasimov at oracle.com
Fri Aug 16 16:32:30 UTC 2013
Sorry, the webrev happened to be empty.
Here's the full one:
On 16.08.2013 17:12, Ivan Gerasimov wrote:
> Hello everybody!
> It was reported that BufferedInputStream#read() method may throw
> This is due to doubling the buffer size in the fill() method without
> checking for a possible overflow.
> BUG: http://bugs.sun.com/view_bug.do?bug_id=7129312
> Affected versions of jdk are 6, 7 and 8
> Would you please help review a fix?
> It uses approach similar to what was suggested for 8020669: The
> maximumBufferSize = (Integer.MAX_INTEGER - 8) constant is introduced
> and we don't make attempts to allocate a bigger array.
> Please note, that the sample code as it was originally reported still
> doesn't work. That's because that setting
> buffStream.mark(Integer.MAX_VALUE) actually means that buffStream will
> have to try to allocate an array of that size given a large enough input.
> Sincerely yours,
More information about the core-libs-dev