Просмотр исходного кода

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.
Marcin Kolny 1 год назад
Родитель
Сommit
ce44e0ec0c
1 измененных файлов с 3 добавлено и 5 удалено
  1. 3 5
      core/iwasm/common/wasm_memory.c

+ 3 - 5
core/iwasm/common/wasm_memory.c

@@ -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