presto-spi/src/main/java/io/prestosql/spi/block/BlockUtil.java/BlockUtil/checkValidRegion
class BlockUtil:    static void checkValidRegion(int positionCount, int positionOffset, int length)
    {
        if (positionOffset < 0 || length < 0 || positionOffset + length > positionCount) {
            throw new IndexOutOfBoundsException(format("Invalid position %s and length %s in block with %s positions", positionOffset, length, positionCount));
        }
    }