From e0de961a175ea970d916a3d01fb1e6c0ae5ceec0 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Sat, 2 Apr 2022 13:32:55 -0700 Subject: [PATCH] Check for too many arguments to convertJsFunctionToWasm signature --- src/runtime_functions.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime_functions.js b/src/runtime_functions.js index d638a41f55835..077bb5a5da487 100644 --- a/src/runtime_functions.js +++ b/src/runtime_functions.js @@ -30,6 +30,9 @@ function convertJsFunctionToWasm(func, sig) { } return new WebAssembly.Function(type, func); } + if (sig.length > 123) { + throw new Error(`Too many arguments! Can handle at most 122 but was given ${sig.length - 1}.`); + } // The module is static, with the exception of the type section, which is // generated based on the signature passed in.