Skip to content

Commit 93ef19b

Browse files
authored
handle nullable heap reference types in import section (#4302)
1 parent 6a00874 commit 93ef19b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/iwasm/interpreter/wasm_loader.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3282,6 +3282,13 @@ load_import_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
32823282
CHECK_BUF(p, p_end, 1);
32833283
/* 0x70 */
32843284
u8 = read_uint8(p);
3285+
#if WASM_ENABLE_GC != 0
3286+
if (wasm_is_reftype_htref_nullable(u8)) {
3287+
int32 heap_type;
3288+
read_leb_int32(p, p_end, heap_type);
3289+
(void)heap_type;
3290+
}
3291+
#endif
32853292
read_leb_uint32(p, p_end, flags);
32863293
read_leb_uint32(p, p_end, u32);
32873294
if (flags & 1)
@@ -3329,7 +3336,7 @@ load_import_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
33293336
/* valtype */
33303337
CHECK_BUF(p, p_end, 1);
33313338
global_type = read_uint8(p);
3332-
if (wasm_is_type_multi_byte_type(global_type)) {
3339+
if (wasm_is_reftype_htref_nullable(global_type)) {
33333340
int32 heap_type;
33343341
read_leb_int32(p, p_end, heap_type);
33353342
(void)heap_type;

0 commit comments

Comments
 (0)