Update spec cases to latest version (#1253)

Update spec cases of mvp/threads to latest version, update wabt
to 1.0.29. And enhance the wasm loader.
This commit is contained in:
Wenyong Huang
2022-06-28 16:05:16 +08:00
committed by GitHub
parent 5e238322c2
commit 625d59191d
4 changed files with 60 additions and 43 deletions

View File

@ -2171,6 +2171,15 @@ load_export_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
export = module->exports;
for (i = 0; i < export_count; i++, export ++) {
#if WASM_ENABLE_THREAD_MGR == 0
if (p == p_end) {
/* export section with inconsistent count:
n export declared, but less than n given */
set_error_buf(error_buf, error_buf_size,
"length out of bounds");
return false;
}
#endif
read_leb_uint32(p, p_end, str_len);
CHECK_BUF(p, p_end, str_len);
@ -9319,8 +9328,15 @@ re_scan:
}
if (loader_ctx->csp_num > 0) {
set_error_buf(error_buf, error_buf_size,
"function body must end with END opcode");
if (cur_func_idx < module->function_count - 1)
/* Function with missing end marker (between two functions) */
set_error_buf(error_buf, error_buf_size, "END opcode expected");
else
/* Function with missing end marker
(at EOF or end of code sections) */
set_error_buf(error_buf, error_buf_size,
"unexpected end of section or function, "
"or section size mismatch");
goto fail;
}

View File

@ -1491,8 +1491,8 @@ wasm_instantiate(WASMModule *module, bool is_sub_inst, uint32 stack_size,
if (stack_size == 0)
stack_size = DEFAULT_WASM_STACK_SIZE;
#if WASM_ENABLE_SPEC_TEST != 0
if (stack_size < 48 * 1024)
stack_size = 48 * 1024;
if (stack_size < 128 * 1024)
stack_size = 128 * 1024;
#endif
module_inst->default_wasm_stack_size = stack_size;