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

Rethink the alloc function of the wasm bindings #375

Closed
tomaka opened this issue Mar 30, 2023 · 1 comment · Fixed by #396
Closed

Rethink the alloc function of the wasm bindings #375

tomaka opened this issue Mar 30, 2023 · 1 comment · Fixed by #396

Comments

@tomaka
Copy link
Contributor

tomaka commented Mar 30, 2023

At the moment, the alloc function is actually undefined behavior: https://github.com/tomaka/smoldot/blob/ed61968acb17347fb039787b4ab5be6ab39cc9fa/wasm-node/rust/src/bindings.rs#L370

To me, the whole approach should maybe be reconsidered, because if you then call for example add_chain with the wrong size, you also have a UB.

@tomaka
Copy link
Contributor Author

tomaka commented Apr 6, 2023

For what it's worth, it seems that wasm-bindgen stores strings in a JS array, then the Rust uses JS functions to obtain the content of the string.

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.

1 participant