Fix warnings/issues reported in Windows and by CodeQL/Coverity (#3275)

Fix the warnings and issues reported:
- in Windows platform
- by CodeQL static code analyzing
- by Coverity static code analyzing

And update CodeQL script to build exception handling and memory features.
This commit is contained in:
Wenyong Huang
2024-04-07 11:57:31 +08:00
committed by GitHub
parent 53f0941ffa
commit 2013f1f7d7
26 changed files with 202 additions and 118 deletions

View File

@ -2567,8 +2567,8 @@ load_from_sections(WASMModule *module, WASMSection *sections,
*buf_func = NULL, *buf_func_end = NULL;
WASMGlobal *aux_data_end_global = NULL, *aux_heap_base_global = NULL;
WASMGlobal *aux_stack_top_global = NULL, *global;
uint64 aux_data_end = (uint64)-1, aux_heap_base = (uint64)-1,
aux_stack_top = (uint64)-1;
uint64 aux_data_end = (uint64)-1LL, aux_heap_base = (uint64)-1LL,
aux_stack_top = (uint64)-1LL;
uint32 global_index, func_index, i;
uint32 aux_data_end_global_index = (uint32)-1;
uint32 aux_heap_base_global_index = (uint32)-1;
@ -2689,7 +2689,7 @@ load_from_sections(WASMModule *module, WASMSection *sections,
aux_heap_base_global = global;
aux_heap_base = (uint64)(uint32)global->init_expr.u.i32;
aux_heap_base_global_index = export->index;
LOG_VERBOSE("Found aux __heap_base global, value: %d",
LOG_VERBOSE("Found aux __heap_base global, value: %" PRIu64,
aux_heap_base);
}
}
@ -2702,7 +2702,7 @@ load_from_sections(WASMModule *module, WASMSection *sections,
aux_data_end_global = global;
aux_data_end = (uint64)(uint32)global->init_expr.u.i32;
aux_data_end_global_index = export->index;
LOG_VERBOSE("Found aux __data_end global, value: %d",
LOG_VERBOSE("Found aux __data_end global, value: %" PRIu64,
aux_data_end);
aux_data_end = align_uint64(aux_data_end, 16);
}
@ -2751,10 +2751,11 @@ load_from_sections(WASMModule *module, WASMSection *sections,
aux_stack_top > aux_data_end
? (uint32)(aux_stack_top - aux_data_end)
: (uint32)aux_stack_top;
LOG_VERBOSE("Found aux stack top global, value: %d, "
"global index: %d, stack size: %d",
aux_stack_top, global_index,
module->aux_stack_size);
LOG_VERBOSE(
"Found aux stack top global, value: %" PRIu64 ", "
"global index: %d, stack size: %d",
aux_stack_top, global_index,
module->aux_stack_size);
break;
}
}
@ -2901,7 +2902,7 @@ load_from_sections(WASMModule *module, WASMSection *sections,
/* Reset memory info to decrease memory usage */
memory_import->num_bytes_per_page = shrunk_memory_size;
memory_import->init_page_count = 1;
LOG_VERBOSE("Shrink import memory size to %d",
LOG_VERBOSE("Shrink import memory size to %" PRIu64,
shrunk_memory_size);
}
}
@ -2914,7 +2915,7 @@ load_from_sections(WASMModule *module, WASMSection *sections,
/* Reset memory info to decrease memory usage */
memory->num_bytes_per_page = shrunk_memory_size;
memory->init_page_count = 1;
LOG_VERBOSE("Shrink memory size to %d",
LOG_VERBOSE("Shrink memory size to %" PRIu64,
shrunk_memory_size);
}
}
@ -5646,7 +5647,7 @@ fail:
wasm_runtime_free(frame_ref_buf);
#if WASM_ENABLE_FAST_INTERP != 0
if (frame_offset_buf && frame_offset_buf != frame_offset_tmp)
wasm_runtime_free(frame_offset_tmp);
wasm_runtime_free(frame_offset_buf);
#endif
return ret;