Skip to content

The binary rules got violated #350

Closed

Description

@dannypsnl

I found an example (https://github.com/sunfishcode/hello-wasi-http) that violates import/export name rules

importname' ::= 0x00 len:<u32> in:<importname>                       => in  (if len = |in|)
exportname' ::= 0x00 len:<u32> en:<exportname>                       => en  (if len = |en|)

The problem part is pointed out as below:

0x1a | 01 13 77 61 | [instance 0] ComponentImport { name: ComponentImportName("wasi:io/[email protected]"), ty: Instance(0) }

0x215de2 | 00 1c 69 6d | [type 0] ComponentImport { name: ComponentImportName("import-type-incoming-request"), ty: Type(SubResource) }

At 0x1a it uses old encoding, meanwhile, at 0x215de2 it uses the rule as document.


Tools version

  • cargo-component-component 0.18.0
  • wit-bindgen-rt = { version = "0.35.0", features = ["bitflags"] }

Activity

  1. sunfishcode commented on Nov 15, 2024

    @sunfishcode
    Member

    This is related to the binary format change in WebAssembly/component-model#263. It appears something is still writing out old-style component import section entries that start with 0x01.

  2. added a commit that references this issue on Nov 15, 2024
    ad961b2
  3. sunfishcode commented on Nov 15, 2024

    @sunfishcode
    Member

    It appears cargo-component 0.18 is using an older version of wasm-encoder. I've now submitted #352 to fix this.

  4. added a commit that references this issue on Nov 15, 2024
    a3e779c
  5. calvinrp commented on Nov 15, 2024

    @calvinrp
    Contributor

    Released 0.19 with the fix

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