From d50b9165cd43a3ef61c56de563815ba766b86a27 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 6 Dec 2022 08:33:32 -0500 Subject: [PATCH] Meta: Manually compute the length of the WASM JS REPL source string The REPL does not have a reliable way to tell us the UTF-8 byte count of the source string, so we must use strlen() ourselves. --- Meta/Lagom/Wasm/js_repl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Meta/Lagom/Wasm/js_repl.cpp b/Meta/Lagom/Wasm/js_repl.cpp index 232df58c7e..cc89a4a214 100644 --- a/Meta/Lagom/Wasm/js_repl.cpp +++ b/Meta/Lagom/Wasm/js_repl.cpp @@ -386,7 +386,7 @@ extern "C" int initialize_repl(char const* time_zone) return 0; } -extern "C" bool execute(char const* s, u32 length) +extern "C" bool execute(char const* source) { - return parse_and_run(*g_interpreter, { s, length }, "REPL"sv); + return parse_and_run(*g_interpreter, { source, strlen(source) }, "REPL"sv); }