wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

fix a potential integer overflow issue

Open lum1n0us opened this issue 1 year ago • 2 comments

  • 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

lum1n0us avatar Jul 27 '22 02:07 lum1n0us

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 to UINT32_MAX

All running modes, interpreter, jit, and aot shall have the same behaviors.

lum1n0us avatar Jul 27 '22 07:07 lum1n0us

But

(module (memory 0 65536))

https://github.com/WebAssembly/spec/blob/e8c05f4b0d3a68bd3b4389b943fbb763a7d3a3ae/test/core/memory.wast#L8

lum1n0us avatar Jul 29 '22 05:07 lum1n0us

https://github.com/bytecodealliance/wasm-micro-runtime/pull/1380

lum1n0us avatar Aug 14 '22 23:08 lum1n0us