Skip to content

WasmModule.loadLinked may return partially initialized module on OOM #39

@jtakakura

Description

@jtakakura

Description

If allocator.create(Vm) fails in WasmModule.loadLinked, the function returns a module with an uninitialized vm field. Later, deinit() on this module triggers undefined behavior.

Steps to reproduce

  1. Simulate OOM during allocator.create(Vm) in loadLinked
  2. Observe that the returned module has an uninitialized vm field
  3. Call deinit() on this module
  4. Undefined behavior occurs (crash or memory error)

zwasm version

1.8.0

Platform

Linux x86_64

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions