[wasm] Throw a RuntimeError if memory lacks guard regions

WebAssembly.Instantiate would silently fail when the passed in memory
object did not have guard regions even though the compiled module assumes
so. This lead to an inconsitent state and a DCHECK error. Instead, now
throw a LinkError.

Change-Id: I68bab842bcc40d3325aea4b19979d80054ed407c
Reviewed-on: https://chromium-review.googlesource.com/1180892
Commit-Queue: Stephan Herhut <herhut@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55601}
This commit is contained in:
Stephan Herhut 2018-09-04 11:52:14 +02:00 committed by Commit Bot
parent 84012551a8
commit 175f2a6a6c

View File

@ -1015,6 +1015,9 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
if (!memory_tracker->HasFullGuardRegions(
memory_.ToHandleChecked()->backing_store())) {
if (!FLAG_wasm_trap_handler_fallback) {
thrower_->LinkError(
"Provided memory is lacking guard regions but fallback was "
"disabled.");
return {};
}