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

Fix class names not being null-terminated #31

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

Arshia001
Copy link
Contributor

@Arshia001 Arshia001 commented Oct 18, 2023

The call to JS_InitClass was using Self::NAME.as_ptr() which is a rust string and is not properly null-terminated, resulting in class names overflowing into neighboring data resulting in names such as:

String("AbortSignalUninitialised ClassExpected Headersa Display implementation returned an error unexpectedly/rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/string.rs/Users/arshia/.cargo/registry/src/index.crates.io-6f17d22bba15001f/http-0.2.9/src/extensions.rs/Users/arshia/.cargo/registry/src/index.crates.io-6f17d22bba15001f/http-0.2.9/src/request.rswant called after cancel/Users/arshia/.cargo/registry/src/index.crates.io-6f17d22bba15001f/want-0.3.1/src/lib.rs/rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/slice.rs/Users/arshia/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytes-1.5.0/src/buf/buf_impl.rs/Users/arshia/.cargo/git/checkouts/hyper-c8030e08a3cfc43d/1e517b1/src/proto/h1/role.rssetting h1 header read timeout timerresetting h1 header read timeout timer/Users/arshia/.cargo/git/checkouts/tokio-2eb71367495b4da5/2be2588/tokio/src/net/tcp/socket.rs")

This PR uses a CString to fix the issue.

@Redfire75369 Redfire75369 merged commit f0bcec4 into Redfire75369:master Oct 18, 2023
5 of 7 checks passed
@Arshia001 Arshia001 deleted the fix-class-names branch October 18, 2023 09:17
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 this pull request may close these issues.

2 participants