Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enum cases size is out of bounds #1019

Closed
MatthiasGrandl opened this issue Aug 6, 2024 · 8 comments · Fixed by bytecodealliance/cargo-component#335
Closed

enum cases size is out of bounds #1019

MatthiasGrandl opened this issue Aug 6, 2024 · 8 comments · Fixed by bytecodealliance/cargo-component#335

Comments

@MatthiasGrandl
Copy link

I generated a very large enum (it's the icon set https://lucide.dev/icons/) . So I have 1424 cases, but sadly it breaks with wit-bindgen with the following error:

Caused by:
    enum cases size is out of bounds (at offset 0xdd)

I tried using a variant instead, but same error. So is this expected or a bug? Is there a suggested alternative for my usecase of exposing a typesafe icon set to my webassembly components?

@MatthiasGrandl
Copy link
Author

PS: the wit works as expected on the host side.

alexcrichton added a commit to alexcrichton/wasm-tools that referenced this issue Aug 6, 2024
Increase some limits from 1_000 to 10_000 to handle
bytecodealliance/wit-bindgen#1019
alexcrichton added a commit to alexcrichton/wasm-tools that referenced this issue Aug 6, 2024
Increase some limits from 1_000 to 10_000 to handle
bytecodealliance/wit-bindgen#1019
@alexcrichton
Copy link
Member

Thanks for the report! The limit here should be fixed in bytecodealliance/wasm-tools#1713

@MatthiasGrandl
Copy link
Author

@alexcrichton good stuff, thanks for hopping on this so quick! I just got started with the wasmtime environment and it's been lovely!

github-merge-queue bot pushed a commit to bytecodealliance/wasm-tools that referenced this issue Aug 8, 2024
* Increase limits of some component types

Increase some limits from 1_000 to 10_000 to handle
bytecodealliance/wit-bindgen#1019

* Lower flags limit
@MatthiasGrandl
Copy link
Author

any idea when this is making it in a release? I tried pulling in the git version of wit-bindgen, but limits are still there.

@alexcrichton
Copy link
Member

The validation error was fixed in a relatively deep portion of the stack but that was awhile ago and so the update should have percolated by now.

@MatthiasGrandl could you detail a bit more how you're seeing this error? That'll help pinpoint what missed the update and what should get updated.

@MatthiasGrandl
Copy link
Author

It happens during compilation of a rust wasm component with cargo component build —release. It is using wit-bindgen and it uses the following enum in wit (attached as file).

icons.wit.txt

@alexcrichton
Copy link
Member

Ah I think you're running into cargo component being on 215 which doesn't have this fix. In trying to update that locally that also needs a publish of wit-bindgen. I'll work on getting these updates out today.

alexcrichton added a commit to alexcrichton/cargo-component that referenced this issue Sep 9, 2024
Bump crates to their latest, notably which I think will help resolve
bytecodealliance/wit-bindgen#1019.
@alexcrichton
Copy link
Member

Ok a new wit-bindgen is released and bytecodealliance/cargo-component#335 should update cargo-component. Mind trying again with a git version of cargo-component to confirm the issue is resolved once that merges?

alexcrichton added a commit to bytecodealliance/cargo-component that referenced this issue Sep 9, 2024
Bump crates to their latest, notably which I think will help resolve
bytecodealliance/wit-bindgen#1019.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants