Skip to content

RandomAccessData.read(long, long) allows bytes to be read beyond the end of a subsection #12986

@wilkinsona

Description

@wilkinsona

#12984 has made it apparent that RandomAccessData.read(long, long) does not define its behaviour in the following scenarios:

  1. the offset is beyond the end of the file
  2. the offset is beyond the end of a subsection
  3. the offset plus length is greater than the length of the file
  4. the offset plus length is greater than the length of the subsection

We need to decide what the behaviour should be in each case and update the interface and implementation accordingly.

I am leaning towards the following at the moment:

  1. Throw an IndexOutOfBoundsException
  2. Throw an IndexOutOfBoundsException
  3. Throw an EOFException
  4. Throw an EOFException

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions