from typing import Tuple


async def read_uleb128(data: bytearray) -> Tuple[int, int]:
    """ Read an unsigned LEB128 (used for string length) from `data`. """
    offset = val = shift = 0

    while True:
        b = data[offset]
        offset += 1

        val |= ((b & 0b01111111) << shift)
        if (b & 0b10000000) == 0x00:
            break

        shift += 7

    return val, offset