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:
@ -41,12 +41,12 @@ static void (*free_func)(void *ptr) = NULL;
|
||||
|
||||
static unsigned int global_pool_size;
|
||||
|
||||
static uint32
|
||||
static uint64
|
||||
align_as_and_cast(uint64 size, uint64 alignment)
|
||||
{
|
||||
uint64 aligned_size = (size + alignment - 1) & ~(alignment - 1);
|
||||
|
||||
return aligned_size > UINT32_MAX ? UINT32_MAX : (uint32)aligned_size;
|
||||
return aligned_size;
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -951,7 +951,7 @@ wasm_allocate_linear_memory(uint8 **data, bool is_shared_memory,
|
||||
{
|
||||
bh_assert(*memory_data_size <= MAX_LINEAR_MEMORY_SIZE);
|
||||
}
|
||||
align_as_and_cast(*memory_data_size, page_size);
|
||||
*memory_data_size = align_as_and_cast(*memory_data_size, page_size);
|
||||
|
||||
if (map_size > 0) {
|
||||
if (!(*data = wasm_mmap_linear_memory(map_size, *memory_data_size))) {
|
||||
@ -960,4 +960,4 @@ wasm_allocate_linear_memory(uint8 **data, bool is_shared_memory,
|
||||
}
|
||||
|
||||
return BHT_OK;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user