Skip to content

Commit 30b02e1

Browse files
committed
src: do not enable wasm trap handler if there's not enough vmem
1 parent c1eb17e commit 30b02e1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/node.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,10 +1258,10 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
12581258
}
12591259

12601260
#if NODE_USE_V8_WASM_TRAP_HANDLER
1261-
bool use_wasm_trap_handler =
1262-
!per_process::cli_options->disable_wasm_trap_handler;
1261+
bool wasm_trap_handler_disabled =
1262+
per_process::cli_options->disable_wasm_trap_handler;
12631263
if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling) &&
1264-
use_wasm_trap_handler) {
1264+
!wasm_trap_handler_disabled && V8::CanEnableWebAssemblyTrapHandler()) {
12651265
#if defined(_WIN32)
12661266
constexpr ULONG first = TRUE;
12671267
per_process::old_vectored_exception_handler =
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Test that with limited virtual memory space, WASM can still allocate memory
2+
// even without --disable-wasm-trap-handler.
3+
'use strict';
4+
5+
require('../common');
6+
new WebAssembly.Memory({ initial: 10, maximum: 100 });

0 commit comments

Comments
 (0)