Skip to content

Commit 837ff63

Browse files
authored
Use 64-bit wasm_runtime_enlarge_memory() increment (#3573)
ps. #3569 (comment)
1 parent 65bf04e commit 837ff63

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

core/iwasm/common/wasm_memory.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,12 @@ wasm_enlarge_memory_internal(WASMModuleInstance *module, uint32 inc_page_count)
921921

922922
bool
923923
wasm_runtime_enlarge_memory(WASMModuleInstanceCommon *module_inst,
924-
uint32_t inc_page_count)
924+
uint64 inc_page_count)
925925
{
926+
if (inc_page_count > UINT32_MAX) {
927+
return false;
928+
}
929+
926930
#if WASM_ENABLE_AOT != 0
927931
if (module_inst->module_type == Wasm_Module_AoT) {
928932
return aot_enlarge_memory((AOTModuleInstance *)module_inst,

core/iwasm/include/wasm_export.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,9 +1842,17 @@ WASM_RUNTIME_API_EXTERN bool
18421842
wasm_runtime_is_import_global_linked(const char *module_name,
18431843
const char *global_name);
18441844

1845+
/**
1846+
* Enlarge the memory region for a module instance
1847+
*
1848+
* @param module_inst the module instance
1849+
* @param inc_page_count the number of pages to add
1850+
*
1851+
* @return true if success, false otherwise
1852+
*/
18451853
WASM_RUNTIME_API_EXTERN bool
18461854
wasm_runtime_enlarge_memory(wasm_module_inst_t module_inst,
1847-
uint32_t inc_page_count);
1855+
uint64_t inc_page_count);
18481856

18491857
typedef enum {
18501858
INTERNAL_ERROR,

0 commit comments

Comments
 (0)