-
Notifications
You must be signed in to change notification settings - Fork 824
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
Add method for reading C-style strings from WasmPtr #1086
Comments
From searching the internet, I've come to believe that the only valid code point containing null is null. If that is correct, I don't see how we should differentiate the terminating null from a "non terminating" one. The only way to get an utf8 string from wasm memory that may contain null is the existing one, knowing offset and length. Am I missing something? Happy to take a stab at this, but can't make promises wrt. time ;) |
Fixes wasmerio#1086. Signed-off-by: Stephan Renatus <[email protected]>
Fixes wasmerio#1086. Signed-off-by: Stephan Renatus <[email protected]>
Fixes wasmerio#1086. Signed-off-by: Stephan Renatus <[email protected]>
Fixes wasmerio#1086. Signed-off-by: Stephan Renatus <[email protected]>
Fixes wasmerio#1086. Signed-off-by: Stephan Renatus <[email protected]>
Fixes wasmerio#1086. Signed-off-by: Stephan Renatus <[email protected]>
Fixes wasmerio#1086. Signed-off-by: Stephan Renatus <[email protected]>
1092: Add function to get nul-terminated strings from memory r=MarkMcCaskey a=srenatus ## Description This is meant to fix #1086. ❓ I'm a bit new to this -- is this how you'd do it? Happy to take directions! 😃 I've added a note regarding the special case in the comment. Are there existing tests to expand? ## Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Stephan Renatus <[email protected]>
Suggested on spectrum .
This is a very good idea, we should support getting a slice from a null-terminated array and probably have a function that just returns a
&str
too. Edge cases to watch out for are null bytes in UTF-8 may be valid if in code point. If that is the case, then we'll want to have a helper method specifically for reading UTF-8 from a WasmPtr with a null terminator. ASCII can probably go through CStrThe text was updated successfully, but these errors were encountered: