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

Off by one bug in newv32? #21

Open
Pyrolistical opened this issue Oct 23, 2022 · 0 comments
Open

Off by one bug in newv32? #21

Pyrolistical opened this issue Oct 23, 2022 · 0 comments

Comments

@Pyrolistical
Copy link

I found your repo in the Zig Discord while learning how to transfer strings from js to zig. Thanks for that btw. Your code really helped me.

While reading your code I think I might have found a bug?

wisp/web/wisp.js

Lines 105 to 106 in b12b8af

const buf = this.api.wisp_alloc(this.heap, 4 * arr.length)
const mem = new Uint32Array(this.api.memory.buffer, buf, arr.length)

In allocStrings +1 is added to the lengths in order to account for the sentinel value, but is missing in newv32.

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

No branches or pull requests

1 participant