wasm-micro-runtime
wasm-micro-runtime copied to clipboard
fix a potential integer overflow issue
- allow max_page_count to be 65536
- allow init_page_count to be 65536
-
num_bytes_per_page * XXX_page_count
will be great than UINT32_MAX
There is a serious AOT compatible problem if updating memory_data_size
of AOTMemoryInstance
from uint32
to uint64
, and we are going to drop the intention and back to
- limit
max_page_count
to 65535 - limit
init_page_count
to 65535 - So,
num_bytes_per_page * XXX_page_count
will be less than or equal toUINT32_MAX
All running modes, interpreter, jit, and aot shall have the same behaviors.
But
(module (memory 0 65536))
https://github.com/WebAssembly/spec/blob/e8c05f4b0d3a68bd3b4389b943fbb763a7d3a3ae/test/core/memory.wast#L8
https://github.com/bytecodealliance/wasm-micro-runtime/pull/1380