Skip to content

Commit 125d79e

Browse files
committed
1 parent c018b8a commit 125d79e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

core/iwasm/interpreter/wasm_loader.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2560,7 +2560,8 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end,
25602560
error_buf_size)) {
25612561
return false;
25622562
}
2563-
if (wasm_is_reftype_htref_non_nullable(ref_type.ref_type)) {
2563+
if (!wasm_is_type_reftype(ref_type.ref_type)
2564+
|| wasm_is_reftype_htref_non_nullable(ref_type.ref_type)) {
25642565
set_error_buf(error_buf, error_buf_size, "type mismatch");
25652566
return false;
25662567
}
@@ -3086,6 +3087,15 @@ load_table(const uint8 **p_buf, const uint8 *buf_end, WASMModule *module,
30863087
error_buf_size)) {
30873088
return false;
30883089
}
3090+
/*
3091+
* TODO: add this validator
3092+
* `wasm_is_reftype_htref_non_nullable(ref_type.ref_type)`
3093+
* after sync up with the latest GC spec
3094+
*/
3095+
if (!wasm_is_type_reftype(ref_type.ref_type)) {
3096+
set_error_buf(error_buf, error_buf_size, "type mismatch");
3097+
return false;
3098+
}
30893099
table->table_type.elem_type = ref_type.ref_type;
30903100
if (need_ref_type_map) {
30913101
if (!(table->table_type.elem_ref_type =
@@ -16525,3 +16535,4 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1652516535
(void)align;
1652616536
return return_value;
1652716537
}
16538+
/*JUST FOR TEST*/

0 commit comments

Comments
 (0)