Skip to content

Commit

Permalink
[wasm][debugger] Fix check for already loaded assemblies (#43747)
Browse files Browse the repository at this point in the history
We send assembly loaded events to the proxy based off events from the
debugger engine. And we check that it isn't an assembly that was already
loaded. This check has a bug in computing the assembly name, from the
filename, which caused these events to be sent even for already loaded
assemblies.
  • Loading branch information
radical committed Oct 23, 2020
1 parent edc8aaa commit 54906ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/mono/wasm/runtime/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ mono_wasm_assembly_already_added (const char *assembly_name)

WasmAssembly *entry = assemblies;
while (entry != NULL) {
if (strlen(entry->assembly.name - 4) == strlen(assembly_name) && strncmp (entry->assembly.name, assembly_name, strlen(entry->assembly.name - 4)) == 0)
int entry_name_minus_extn_len = strlen(entry->assembly.name) - 4;
if (entry_name_minus_extn_len == strlen(assembly_name) && strncmp (entry->assembly.name, assembly_name, entry_name_minus_extn_len) == 0)
return 1;
entry = entry->next;
}
Expand Down
3 changes: 0 additions & 3 deletions src/mono/wasm/runtime/library_mono.js
Original file line number Diff line number Diff line change
Expand Up @@ -2365,9 +2365,6 @@ var MonoSupportLib = {
if (MONO.mono_wasm_runtime_is_ready !== true)
return;

if (!this.mono_wasm_assembly_already_added)
this.mono_wasm_assembly_already_added = Module.cwrap ("mono_wasm_assembly_already_added", 'number', ['string']);

const assembly_name_str = assembly_name !== 0 ? Module.UTF8ToString(assembly_name).concat('.dll') : '';

const assembly_data = new Uint8Array(Module.HEAPU8.buffer, assembly_ptr, assembly_len);
Expand Down

0 comments on commit 54906ea

Please sign in to comment.