private void ensureBounds(long index, long length) throws IOException {
		// ensure length is valid
		if (length < 0 || length > Integer.MAX_VALUE) {
			throw new IOException(
				"Unable to read more than Integer.MAX_VALUE bytes in one operation: %s"
						.formatted(Long.toUnsignedString(length)));
		}
		if (index == 0 && length == 0) {
			return;	// success for read of 0 bytes at offset 0
		}

		// ensure read start index is valid
		if (isEmtpy || Long.compareUnsigned(index, maxOffset) > 0) {
			throw new EOFException("Invalid index: %s".formatted(Long.toUnsignedString(index)));
		}

		// NOTE: there should be a +1 on "remaining" to accurately model the count of remaining bytes
		// Because it could cause an overflow, adjust "length" by -1 instead 
		long remaining = maxOffset - index /* + 1 -> becomes length - 1 */;

		// ensure length of read is within bounds
		if (length != 0 && Long.compareUnsigned(length - 1, remaining) > 0) {
			throw new EOFException(
				"Unable to read past EOF: %s, %d".formatted(Long.toUnsignedString(index), length));
		}
	}
Returns the address range of the bytes of this provider.

@return address range of first byte to last byte of this provider
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/MemoryByteProvider.java