We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@sbc100 @kripken
This is a crazy one.
I pass Base64 strings like eyJuYW1lIjogIkphc29uIiwgImFnZSI6ICI0OCJ9 to JavaScript side.
eyJuYW1lIjogIkphc29uIiwgImFnZSI6ICI0OCJ9
Basically,
std::string text = "eyJuYW1lIjogIkphc29uIiwgImFnZSI6ICI0OCJ9"; // Call C-extern function printSomething(text.c_str());
Now Javascript side try convert the pointer passed to JS function to UTF8 string using this way,
printSomething: async function(pText) { let converted = UTF8ToString(pText); console.log(converted) }
But it returns an empty string as a result instead eyJuYW1lIjogIkphc29uIiwgImFnZSI6ICI0OCJ9.
I've ran the Javascript debugger over UTF8ToString and I find that it returns "\u0001" so for naked eye it's an empty string..
The text was updated successfully, but these errors were encountered:
I've ran dozens of texts to make sure this issue is not on my side. This doesn't happen with simple strings according to my tests.
"Hello World" "FooBar" "Dan Rocks" "www.google.com"
All got printed..
I'm using following flags when compiling
-Wall -Wextra -g2 -s ASSERTIONS=2 -s INITIAL_MEMORY=500MB -s ALLOW_MEMORY_GROWTH=1 -fsanitize=address -fsanitize=undefined -s DEMANGLE_SUPPORT=1 -gseparate-dwarf -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_TABLE_GROWTH=1 -std=gnu++17
Ubsan and Address Sanitizer is enabled and It didn't caught anything like heap after use etc
Sorry, something went wrong.
Turns out, I'm using an invalidated pointer but for some reason the small strings got lucky. Fixed it by using a local copy inside class...
Do async functions work at all in library JS files? What does that mean in that context?
async
No branches or pull requests
@sbc100 @kripken
This is a crazy one.
I pass Base64 strings like
eyJuYW1lIjogIkphc29uIiwgImFnZSI6ICI0OCJ9
to JavaScript side.Basically,
Now Javascript side try convert the pointer passed to JS function to UTF8 string using this way,
But it returns an empty string as a result instead
eyJuYW1lIjogIkphc29uIiwgImFnZSI6ICI0OCJ9
.I've ran the Javascript debugger over UTF8ToString and I find that it returns "\u0001" so for naked eye it's an empty string..
The text was updated successfully, but these errors were encountered: