Skip to content

Defining an implementation limit on initializer expression size #1557

Open
@Liedtke

Description

@Liedtke

An initializer expression is very similar to a function body just with a much more restricted set of allowed instructions.

For function bodys we have a limit of 7,654,321 bytes each. [spec]
I'd argue that we should therefore also introduce at least the same limit to constant initializer expressions (or a smaller limit)?

Given the generous limit this shouldn't be breaking anybody (wasm-gc is probably right now the only feature where initializer expressions could get somewhat large if e.g. a global defines an object with deeply nested objects and arrays).


Context: Our init-expression fuzzer in V8 generated some deeply nested structs with non-nullable references and then decided to generate an ~8MB initializer expression to populate a struct of that type. The fuzzer compares the result against running a function with the same body as the initializer expression expecting that we produce an equivalent object but ran into this limit on the function body after successfully decoding and accepting the huge initializer expression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions