We should not mmap zero bytes for a memory in Wasm
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 May 2017 00:32:12 +0000 (00:32 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 May 2017 00:32:12 +0000 (00:32 +0000)
commit03782895baeff5510eb3d9713e28d50dc1a56207
treea7e49f7d7e46823cb754e1f33a9fac45999478a3
parente4d96f6f3c85e4fff4a54681105793d77d2a5648
We should not mmap zero bytes for a memory in Wasm
https://bugs.webkit.org/show_bug.cgi?id=172528
<rdar://problem/32257076>

Reviewed by Mark Lam.

JSTests:

* wasm/js-api/dont-mmap-zero-byte-memory.js: Added.
(testMems):

Source/JavaScriptCore:

This patch fixes a bug where we would call into mmap with zero bytes
when creating a slow WasmMemory with zero initial page size. This fix
is simple: if we don't have any initial bytes, we just call the constructor
in WasmMemory that's meant to handle this case.

* wasm/WasmMemory.cpp:
(JSC::Wasm::Memory::create):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@217314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/wasm/js-api/dont-mmap-zero-byte-memory.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wasm/WasmMemory.cpp