Skip to content

Commit f6c9cb5

Browse files
committed
1 parent 3580d1a commit f6c9cb5

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
@@ -2583,7 +2583,8 @@ load_table_import(const uint8 **p_buf, const uint8 *buf_end,
25832583
error_buf_size)) {
25842584
return false;
25852585
}
2586-
if (wasm_is_reftype_htref_non_nullable(ref_type.ref_type)) {
2586+
if (!wasm_is_type_reftype(ref_type.ref_type)
2587+
|| wasm_is_reftype_htref_non_nullable(ref_type.ref_type)) {
25872588
set_error_buf(error_buf, error_buf_size, "type mismatch");
25882589
return false;
25892590
}
@@ -3109,6 +3110,15 @@ load_table(const uint8 **p_buf, const uint8 *buf_end, WASMModule *module,
31093110
error_buf_size)) {
31103111
return false;
31113112
}
3113+
/*
3114+
* TODO: add this validator
3115+
* `wasm_is_reftype_htref_non_nullable(ref_type.ref_type)`
3116+
* after sync up with the latest GC spec
3117+
*/
3118+
if (!wasm_is_type_reftype(ref_type.ref_type)) {
3119+
set_error_buf(error_buf, error_buf_size, "type mismatch");
3120+
return false;
3121+
}
31123122
table->table_type.elem_type = ref_type.ref_type;
31133123
if (need_ref_type_map) {
31143124
if (!(table->table_type.elem_ref_type =

0 commit comments

Comments
 (0)