kotlinx-io icon indicating copy to clipboard operation
kotlinx-io copied to clipboard

readFully/readAvailable length parameter default value

Open Xfel opened this issue 7 years ago • 0 comments
trafficstars

The array-reading functions readFully and readAvailable are defined with default values for the offset and length parameter. If you only specify an explicit value for offset, length will default to array.size. If offset is not zero, this leads to an array bounds error, since it tries to write to the range of [offset, offset+length).

A more sensible default might be array.size - offset.

Xfel avatar Sep 22 '18 15:09 Xfel