Allow converting the zero wasm address to native (#3215)

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.
This commit is contained in:
Marcin Kolny 2024-03-12 09:46:11 +00:00 committed by GitHub
parent df57e70437
commit ce44e0ec0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -426,15 +426,13 @@ wasm_runtime_addr_app_to_native(WASMModuleInstanceCommon *module_inst_comm,
SHARED_MEMORY_UNLOCK(memory_inst); SHARED_MEMORY_UNLOCK(memory_inst);
return addr; return addr;
} }
}
/* If bounds checks is disabled, return the address directly */
else if (app_offset != 0) {
SHARED_MEMORY_UNLOCK(memory_inst); SHARED_MEMORY_UNLOCK(memory_inst);
return addr; return NULL;
} }
/* If bounds checks is disabled, return the address directly */
SHARED_MEMORY_UNLOCK(memory_inst); SHARED_MEMORY_UNLOCK(memory_inst);
return NULL; return addr;
} }
uint64 uint64