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

[release/6.0-rc2] [wasm][debugger] Fixing memory corruption #59420

Merged
merged 1 commit into from
Sep 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/mono/wasm/runtime/library_mono.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,8 @@ var MonoSupportLib = {

mono_wasm_send_dbg_command_with_parms: function (id, command_set, command, command_parameters, length, valtype, newvalue)
{
const dataHeap = new Uint8Array (Module.HEAPU8.buffer, command_parameters, command_parameters.length);
dataHeap.set (new Uint8Array (this._base64_to_uint8 (command_parameters)));
this._c_fn_table.mono_wasm_send_dbg_command_with_parms_wrapper (id, command_set, command, dataHeap.byteOffset, length, valtype, newvalue.toString());
var dataHeap = this.mono_wasm_load_bytes_into_heap (this._base64_to_uint8 (command_parameters));
this._c_fn_table.mono_wasm_send_dbg_command_with_parms_wrapper (id, command_set, command, dataHeap, length, valtype, newvalue.toString());
let { res_ok, res } = MONO.commands_received;
if (!res_ok)
throw new Error (`Failed on mono_wasm_invoke_method_debugger_agent_with_parms`);
Expand All @@ -594,11 +593,8 @@ var MonoSupportLib = {

mono_wasm_send_dbg_command: function (id, command_set, command, command_parameters)
{
const dataHeap = new Uint8Array (Module.HEAPU8.buffer, command_parameters, command_parameters.length);
dataHeap.set (new Uint8Array (this._base64_to_uint8 (command_parameters)));

this._c_fn_table.mono_wasm_send_dbg_command_wrapper (id, command_set, command, dataHeap.byteOffset, command_parameters.length);

var dataHeap = this.mono_wasm_load_bytes_into_heap (this._base64_to_uint8 (command_parameters));
this._c_fn_table.mono_wasm_send_dbg_command_wrapper (id, command_set, command, dataHeap, command_parameters.length);
let { res_ok, res } = MONO.commands_received;
if (!res_ok)
throw new Error (`Failed on mono_wasm_send_dbg_command`);
Expand Down