Add more buffer boundary checks in wasm loader (#2734)
And fix exception not printed in `iwasm --repl` mode and resize the memory data size to UINT32_MAX if the initial page number is 65536.
This commit is contained in:
@ -276,6 +276,12 @@ memory_instantiate(WASMModuleInstance *module_inst, WASMModuleInstance *parent,
|
||||
if (max_page_count > DEFAULT_MAX_PAGES)
|
||||
max_page_count = DEFAULT_MAX_PAGES;
|
||||
}
|
||||
else { /* heap_size == 0 */
|
||||
if (init_page_count == DEFAULT_MAX_PAGES) {
|
||||
num_bytes_per_page = UINT32_MAX;
|
||||
init_page_count = max_page_count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_VERBOSE("Memory instantiate:");
|
||||
LOG_VERBOSE(" page bytes: %u, init pages: %u, max pages: %u",
|
||||
|
||||
Reference in New Issue
Block a user