You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A wasm-bindgen - generated module returns bindings which initialise tables used to allow Rust to generate JS values. The emitted bindings (usually the *_js_bg.js file) contains a __wbindgen_init_externref_table() function which correctly initialises these constants. However, the current system does not call this function.
Steps to Reproduce
Generate a wasm-bindgen module which calls JsValue::null()
This can be observed more reliably by "doing something" before printing out null values because the uninitialised constants table will leak memory. For example, I was implementing a REPL for a parser I implemented in Rust. When the expression returned a null value, it is cast back to a JsValue::null(). Before the initialisation, this call would print out the value I typed into the REPL which first caused it to return null. If that were a password for example, that could be a major security issue.
If applicable, add a link to a test case (as a zip file or link to a repository we can clone).
Expected Behavior
The utility module's __wbg_set_wasm() function should also initialise the wasm context by calling the necessary initialisation functions.
Actual Behavior
A clear and concise description of what actually happened.
If applicable, add screenshots to help explain your problem.
Negative
Positive
The two screenshots show the results of enabling/disabling the initialisation. In both cases, the query {a:0} returns a null value (represented by the keyword nothing).
The left screenshot shows the conversion of a Nothing to a JsValue("{a:0}") while the right shows the correct transformation into a JsValue(null)
Additional Context
A non-functional real-life example can be found here.
clone that exact tag, build the module and run the example repl.ts. Enter {a:0} to observe error.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Describe the Bug
A wasm-bindgen - generated module returns bindings which initialise tables used to allow Rust to generate JS values. The emitted bindings (usually the
*_js_bg.js
file) contains a__wbindgen_init_externref_table()
function which correctly initialises these constants. However, the current system does not call this function.Steps to Reproduce
JsValue::null()
null
values because the uninitialised constants table will leak memory. For example, I was implementing a REPL for a parser I implemented in Rust. When the expression returned a null value, it is cast back to aJsValue::null()
. Before the initialisation, this call would print out the value I typed into the REPL which first caused it to returnnull
. If that were a password for example, that could be a major security issue.If applicable, add a link to a test case (as a zip file or link to a repository we can clone).
Expected Behavior
The utility module's
__wbg_set_wasm()
function should also initialise the wasm context by calling the necessary initialisation functions.Actual Behavior
A clear and concise description of what actually happened.
If applicable, add screenshots to help explain your problem.
The two screenshots show the results of enabling/disabling the initialisation. In both cases, the query
{a:0}
returns a null value (represented by the keyword nothing).The left screenshot shows the conversion of a
Nothing
to aJsValue("{a:0}")
while the right shows the correct transformation into aJsValue(null)
Additional Context
A non-functional real-life example can be found here.
The text was updated successfully, but these errors were encountered: