Language: Python
Label: safe
CWE: CWE-682 \u2014 Incorrect Calculation
The product performs a calculation that generates incorrect or unintended results that are later used in security-critical decisions or resource management.

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