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

@ -309,9 +309,11 @@ handle_general_query(WASMGDBServer *server, char *payload)
}
if (!strcmp(name, "WasmData")) {
write_packet(server, "");
}
if (!strcmp(name, "WasmMem")) {
write_packet(server, "");
}
if (!strcmp(name, "Symbol")) {
@ -447,7 +449,7 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
"thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc,
pc_string, "trace");
}
else if (status > 0) {
else { /* status > 0 (== 0 is checked at the function beginning) */
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
"thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc,
pc_string, "signal");

View File

@ -1123,7 +1123,8 @@ posix_memalign_wrapper(wasm_exec_env_t exec_env, void **memptr, int32 align,
wasm_module_inst_t module_inst = get_module_inst(exec_env);
void *p = NULL;
*((int32 *)memptr) = module_malloc(size, (void **)&p);
/* TODO: for memory 64, module_malloc may return uint64 offset */
*((uint32 *)memptr) = (uint32)module_malloc(size, (void **)&p);
if (!p)
return -1;

View File

@ -3,6 +3,9 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#ifndef _BLOCKING_OP_H_
#define _BLOCKING_OP_H_
#include "bh_platform.h"
#include "wasm_export.h"
@ -57,3 +60,5 @@ __wasi_errno_t
blocking_op_poll(wasm_exec_env_t exec_env, struct pollfd *pfds, nfds_t nfds,
int timeout, int *retp);
#endif
#endif /* end of _BLOCKING_OP_H_ */