Skip to content

Commit

Permalink
Allow converting the zero wasm address to native (bytecodealliance#3215)
Browse files Browse the repository at this point in the history
This allows to know the beginning of the wasm address space. At the moment
to achieve that, we need to apply a `hack wasm_runtime_addr_app_to_native(X)-X`
to get the beginning of WASM memory in the nativ code, but I don't see a good
reason why not to allow zero address as a parameter value for this function.
  • Loading branch information
loganek authored Mar 12, 2024
1 parent df57e70 commit ce44e0e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions core/iwasm/common/wasm_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,13 @@ wasm_runtime_addr_app_to_native(WASMModuleInstanceCommon *module_inst_comm,
SHARED_MEMORY_UNLOCK(memory_inst);
return addr;
}
}
/* If bounds checks is disabled, return the address directly */
else if (app_offset != 0) {
SHARED_MEMORY_UNLOCK(memory_inst);
return addr;
return NULL;
}

/* If bounds checks is disabled, return the address directly */
SHARED_MEMORY_UNLOCK(memory_inst);
return NULL;
return addr;
}

uint64
Expand Down

0 comments on commit ce44e0e

Please sign in to comment.