kotlinx-io
kotlinx-io copied to clipboard
readFully/readAvailable length parameter default value
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.