Skip to content

Commit 75bf979

Browse files
authored
1 parent 5478d26 commit 75bf979

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

core/iwasm/interpreter/wasm_loader.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,8 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end,
25882588
error_buf_size)) {
25892589
return false;
25902590
}
2591-
if (wasm_is_reftype_htref_non_nullable(ref_type.ref_type)) {
2591+
if (!wasm_is_type_reftype(ref_type.ref_type)
2592+
|| wasm_is_reftype_htref_non_nullable(ref_type.ref_type)) {
25922593
set_error_buf(error_buf, error_buf_size, "type mismatch");
25932594
return false;
25942595
}
@@ -3114,6 +3115,15 @@ load_table(const uint8 **p_buf, const uint8 *buf_end, WASMModule *module,
31143115
error_buf_size)) {
31153116
return false;
31163117
}
3118+
/*
3119+
* TODO: add this validator
3120+
* `wasm_is_reftype_htref_non_nullable(ref_type.ref_type)`
3121+
* after sync up with the latest GC spec
3122+
*/
3123+
if (!wasm_is_type_reftype(ref_type.ref_type)) {
3124+
set_error_buf(error_buf, error_buf_size, "type mismatch");
3125+
return false;
3126+
}
31173127
table->table_type.elem_type = ref_type.ref_type;
31183128
if (need_ref_type_map) {
31193129
if (!(table->table_type.elem_ref_type =

0 commit comments

Comments
 (0)