mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-11 09:25:20 +00:00
Fix potential integer overflow issue in wasm-c-api (#1954)
Fix potential integer overflow issue in wasm-c-api reported by CodeQL
This commit is contained in:
parent
89c11c5361
commit
427abf02c8
|
@ -4205,7 +4205,8 @@ wasm_memory_data_size(const wasm_memory_t *memory)
|
|||
(WASMModuleInstance *)module_inst_comm;
|
||||
WASMMemoryInstance *memory_inst =
|
||||
module_inst->memories[memory->memory_idx_rt];
|
||||
return memory_inst->cur_page_count * memory_inst->num_bytes_per_page;
|
||||
return (size_t)memory_inst->cur_page_count
|
||||
* memory_inst->num_bytes_per_page;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4215,7 +4216,8 @@ wasm_memory_data_size(const wasm_memory_t *memory)
|
|||
AOTMemoryInstance *memory_inst =
|
||||
((AOTMemoryInstance **)
|
||||
module_inst->memories)[memory->memory_idx_rt];
|
||||
return memory_inst->cur_page_count * memory_inst->num_bytes_per_page;
|
||||
return (size_t)memory_inst->cur_page_count
|
||||
* memory_inst->num_bytes_per_page;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user