Skip to content

Commit e6a47d5

Browse files
In wasm32, fix potential conversion overflow when enlarging 65536 pages (#4064)
fix enlarge 65536 pages conversion overflow in wasm32
1 parent c99ae24 commit e6a47d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/iwasm/common/wasm_memory.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1389,20 +1389,20 @@ wasm_enlarge_memory_internal(WASMModuleInstanceCommon *module,
13891389
if (full_size_mmaped) {
13901390
#ifdef BH_PLATFORM_WINDOWS
13911391
if (!os_mem_commit(memory->memory_data_end,
1392-
(mem_offset_t)(total_size_new - total_size_old),
1392+
total_size_new - total_size_old,
13931393
MMAP_PROT_READ | MMAP_PROT_WRITE)) {
13941394
ret = false;
13951395
goto return_func;
13961396
}
13971397
#endif
13981398

13991399
if (os_mprotect(memory->memory_data_end,
1400-
(mem_offset_t)(total_size_new - total_size_old),
1400+
total_size_new - total_size_old,
14011401
MMAP_PROT_READ | MMAP_PROT_WRITE)
14021402
!= 0) {
14031403
#ifdef BH_PLATFORM_WINDOWS
14041404
os_mem_decommit(memory->memory_data_end,
1405-
(mem_offset_t)(total_size_new - total_size_old));
1405+
total_size_new - total_size_old);
14061406
#endif
14071407
ret = false;
14081408
goto return_func;

0 commit comments

Comments
 (0)