Add more checks to enhance security (#446)

add more checks to enhance security
clear "wasi proc exit" exception before return to caller in wasm/aot call functions
fix memory profiling issue
change movdqa to movdqu in simd invokeNative asm codes to fix issue of unaligned address access
move setjmp/longjmp from libc-builtin to libc-emcc
fix zephyr platform compilation issue in latest zephyr version
This commit is contained in:
Wenyong Huang
2020-11-24 14:00:09 +08:00
committed by GitHub
parent f4770ae8c8
commit 74be7a0b7c
24 changed files with 397 additions and 216 deletions

View File

@ -8,8 +8,6 @@
void bh_assert_internal(int v, const char *file_name, int line_number,
const char *expr_string)
{
int i;
if (v)
return;
@ -22,10 +20,6 @@ void bh_assert_internal(int v, const char *file_name, int line_number,
os_printf("\nASSERTION FAILED: %s, at file %s, line %d\n",
expr_string, file_name, line_number);
i = os_printf(" ");
/* divived by 0 to make it abort */
os_printf("%d\n", i / (i - 1));
while (1);
abort();
}

View File

@ -290,11 +290,11 @@ bh_hash_map_destroy(HashMap *map)
uint32
bh_hash_map_get_struct_size(HashMap *hashmap)
{
uint32 size = offsetof(HashMap, elements)
+ sizeof(HashMapElem *) * hashmap->size;
uint32 size = (uint32)(uintptr_t)offsetof(HashMap, elements)
+ (uint32)sizeof(HashMapElem *) * hashmap->size;
if (hashmap->lock) {
size += sizeof(korp_mutex);
size += (uint32)sizeof(korp_mutex);
}
return size;
@ -303,7 +303,7 @@ bh_hash_map_get_struct_size(HashMap *hashmap)
uint32
bh_hash_map_get_elem_struct_size()
{
return sizeof(HashMapElem);
return (uint32)sizeof(HashMapElem);
}
bool
@ -335,4 +335,4 @@ bh_hash_map_traverse(HashMap *map, TraverseCallbackFunc callback)
}
return true;
}
}