mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-30 13:37:38 +00:00
Appease some UBSan complaints (#720)
This commit is contained in:
parent
4e4d48e72b
commit
79f163d08b
|
@ -8580,12 +8580,12 @@ unsupported_opcode:
|
||||||
goto re_scan;
|
goto re_scan;
|
||||||
|
|
||||||
func->const_cell_num = loader_ctx->const_cell_num;
|
func->const_cell_num = loader_ctx->const_cell_num;
|
||||||
if (func->const_cell_num > 0
|
if (func->const_cell_num > 0) {
|
||||||
&& !(func->consts = func_const =
|
if (!(func->consts = func_const =
|
||||||
loader_malloc(func->const_cell_num * 4,
|
loader_malloc(func->const_cell_num * 4,
|
||||||
error_buf, error_buf_size))) {
|
error_buf, error_buf_size)))
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
|
||||||
func_const_end = func->consts + func->const_cell_num * 4;
|
func_const_end = func->consts + func->const_cell_num * 4;
|
||||||
/* reverse the const buf */
|
/* reverse the const buf */
|
||||||
for (int i = loader_ctx->num_const - 1; i >= 0; i--) {
|
for (int i = loader_ctx->num_const - 1; i >= 0; i--) {
|
||||||
|
@ -8602,6 +8602,7 @@ unsupported_opcode:
|
||||||
func_const += sizeof(int32);
|
func_const += sizeof(int32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func->max_stack_cell_num = loader_ctx->preserved_local_offset -
|
func->max_stack_cell_num = loader_ctx->preserved_local_offset -
|
||||||
loader_ctx->start_dynamic_offset + 1;
|
loader_ctx->start_dynamic_offset + 1;
|
||||||
|
|
|
@ -80,8 +80,13 @@ int BH_VPRINTF(const char *format, va_list ap);
|
||||||
|
|
||||||
/* Return the offset of the given field in the given type */
|
/* Return the offset of the given field in the given type */
|
||||||
#ifndef offsetof
|
#ifndef offsetof
|
||||||
|
/* GCC 4.0 and later has the builtin. */
|
||||||
|
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||||
|
#define offsetof(Type, field) __builtin_offsetof(Type, field)
|
||||||
|
#else
|
||||||
#define offsetof(Type, field) ((size_t)(&((Type *)0)->field))
|
#define offsetof(Type, field) ((size_t)(&((Type *)0)->field))
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef uint8_t uint8;
|
typedef uint8_t uint8;
|
||||||
typedef int8_t int8;
|
typedef int8_t int8;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user