From 175f2a6a6cabbfb9498dab82b27e45e54438a5d1 Mon Sep 17 00:00:00 2001 From: Stephan Herhut Date: Tue, 4 Sep 2018 11:52:14 +0200 Subject: [PATCH] [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 Reviewed-by: Andreas Haas Cr-Commit-Position: refs/heads/master@{#55601} --- src/wasm/module-compiler.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wasm/module-compiler.cc b/src/wasm/module-compiler.cc index 4a6bab6250..7599f7828d 100644 --- a/src/wasm/module-compiler.cc +++ b/src/wasm/module-compiler.cc @@ -1015,6 +1015,9 @@ MaybeHandle 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 {}; }