Language: Python
Label: safe
CWE: CWE-193 \u2014 Off-by-one Error
A product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value.

Code:
def set_code_offsets(vyper_module: vy_ast.Module) -> Dict:
    ret = {}
    offset = 0

    for node in vyper_module.get_children(vy_ast.VariableDecl, filters={"is_immutable": True}):
        varinfo = node.target._metadata["varinfo"]
        type_ = varinfo.typ
        varinfo.set_position(CodeOffset(offset))

        len_ = ceil32(type_.size_in_bytes)

        # this could have better typing but leave it untyped until
        # we understand the use case better
        ret[node.target.id] = {"type": str(type_), "offset": offset, "length": len_}

        offset += len_

    return ret