private static Address findEndOfBlock(Memory memory, Address minAddr) {
		MemoryBlock block = memory.getBlock(minAddr);
		if (block != null) {
			// address was inside a block, return it's end
			return block.getEnd();
		}

		// address was outside all blocks.  try to find a block that contains it and return its end
		AddressSpace space = minAddr.getAddressSpace();
		for (MemoryBlock block2 : memory.getBlocks()) {
			Address end = block2.getEnd();
			if (end.getAddressSpace().equals(space) && end.compareTo(minAddr) >= 0) {
				return end;
			}
		}
		return null;
	}
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