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:
- interpreter: silently shortens or expands arguments array here
|
this.locals = Arrays.copyOf(args, sizeOf(argsTypes) + sizeOf(localTypes)); |
- runtime compilation: causes
ArrayIndexOutOfBoundsException without much details
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();
Version
Description
It looks like calling an exported function with an incorrect number of arguments is not properly handled:
endive/runtime/src/main/java/run/endive/runtime/StackFrame.java
Line 59 in 7505798
ArrayIndexOutOfBoundsExceptionwithout much detailsNot 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: