Fix wasm loader check data segment count (#4039)

correctly report error when datacount section has non-zero data segment count while the data section is not present
This commit is contained in:
TianlongLiang
2025-01-21 13:08:09 +08:00
committed by GitHub
parent e3ddbd58f7
commit b6dea221a6
2 changed files with 31 additions and 3 deletions

View File

@ -2734,6 +2734,11 @@ load_from_sections(WASMModule *module, WASMSection *sections,
section = section->next;
}
#if WASM_ENABLE_BULK_MEMORY != 0
bh_assert(!has_datacount_section
|| module->data_seg_count == module->data_seg_count1);
#endif
module->aux_data_end_global_index = (uint32)-1;
module->aux_heap_base_global_index = (uint32)-1;
module->aux_stack_top_global_index = (uint32)-1;