Skip to content

CALL_INDIRECT resolves caller type indices against the referenced function's module #88

Description

@hidekatsu-izuno

Summary

CALL_INDIRECT resolves the caller’s type index using the module that owns the table function. Type indices are module-local, so this fails for functions from another module in a shared table (unknown type 21).

Fix

In CALL_INDIRECT and RETURN_CALL_INDIRECT:

var refInstance = requireNonNullElse(table.instance(funcTableIdx), instance);
var expectedType = instance.type(typeId); 
var actualType = refInstance.type(refInstance.functionType(funcId));
verifyIndirectCall(actualType, expectedType, instance.module().typeSection());

Specification references

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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