core/shared/platform: Zero memory returned by os_mmap in some platforms (#3551)
The os_mmap should zero the mapped memory like what posix mmap does.
This commit is contained in:
@ -43,8 +43,10 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
|
||||
uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t);
|
||||
*addr_field = (uintptr_t)buf_origin;
|
||||
#if (WASM_MEM_DUAL_BUS_MIRROR != 0)
|
||||
memset(buf_fixed + MEM_DUAL_BUS_OFFSET, 0, size);
|
||||
return buf_fixed + MEM_DUAL_BUS_OFFSET;
|
||||
#else
|
||||
memset(buf_fixed, 0, size);
|
||||
return buf_fixed;
|
||||
#endif
|
||||
}
|
||||
@ -71,6 +73,7 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
|
||||
uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t);
|
||||
*addr_field = (uintptr_t)buf_origin;
|
||||
|
||||
memset(buf_fixed, 0, size);
|
||||
return buf_fixed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user