Skip to content

ml-proto's grow_memory traps on integer overflow #307

@sunfishcode

Description

@sunfishcode

The design repo says that grow_memory should return -1 on allocation failure and does not mention the possibility of trapping:
https://github.com/WebAssembly/design/blob/master/AstSemantics.md#resizing

ml-proto's implementation for grow_memory traps on overflow when converting from pages to bytes, or if the size exceeds an internal implementation limit and does not appear to have code for returning -1 on allocation failure:
https://github.com/WebAssembly/spec/blob/master/ml-proto/spec/eval.ml#L288
https://github.com/WebAssembly/spec/blob/master/ml-proto/spec/memory.ml#L71

(Moving this issue from WebAssembly/design#714, since this appears to be an ml-proto issue rather than a design issue.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions