Skip to content

Wrong argument count when calling exported functions is not properly handled #99

Description

@Marcono1234

Version

  • Endive 1.0.1
  • OpenJDK Runtime Environment Temurin-21.0.8+9 (build 21.0.8+9-LTS)

Description

It looks like calling an exported function with an incorrect number of arguments is not properly handled:

Not sure what the specification requires, but ideally the behavior should be consistent and in case of an error throw a user-friendly exception.

Here is an example:

byte[] bytes = Base64.getDecoder().decode("AGFzbQEAAAABBgFgAX8BfwMCAQAHCwEHZXhhbXBsZQAACgYBBAAgAAsACgRuYW1lAgMBAAA");
WasmModule module = Parser.parse(bytes);
Instance instance = Instance.builder(module)
    .withMachineFactory(MachineFactoryCompiler::compile)
    .build();
ExportFunction export = instance.export("example");
export.apply();

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