Fix potential integer overflow issues (#4429)
It is reported as "Multiplication result converted to larger type". And "Multiplication result may overflow 'Type A' before it is converted to 'Type B'." Type A is a larger type than Type B. Since the conversion applies after the multiplication, arithmetic overflow may still occur. > The rule flags every multiplication of two non-constant integer expressions > that is (explicitly or implicitly) converted to a larger integer type. The > conversion is an indication that the expression would produce a result that > would be too large to fit in the smaller integer type.
This commit is contained in:
@ -4161,7 +4161,7 @@ wasm_get_module_inst_mem_consumption(const WASMModuleInstance *module_inst,
|
||||
sizeof(WASMMemoryInstance *) * module_inst->memory_count;
|
||||
for (i = 0; i < module_inst->memory_count; i++) {
|
||||
WASMMemoryInstance *memory = module_inst->memories[i];
|
||||
size = memory->num_bytes_per_page * memory->cur_page_count;
|
||||
size = (uint64)memory->num_bytes_per_page * memory->cur_page_count;
|
||||
mem_conspn->memories_size += size;
|
||||
mem_conspn->app_heap_size += memory->heap_data_end - memory->heap_data;
|
||||
/* size of app heap structure */
|
||||
|
||||
Reference in New Issue
Block a user