fix: alter coreModuleRegExp to prevent arm crash

This commit is contained in:
Shelley Vohr
2023-02-02 10:02:37 +01:00
parent 4f25a39463
commit 7e50630c98
2 changed files with 25 additions and 0 deletions

View File

@@ -36,3 +36,4 @@ enable_crashpad_linux_node_processes.patch
allow_embedder_to_control_codegenerationfromstringscallback.patch
chore_remove_errant_semicolons.patch
chore_remove_unreached_return.patch
fix_alter_coremoduleregexp_to_prevent_arm_crash.patch

View File

@@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 2 Feb 2023 09:59:24 +0100
Subject: fix: alter coreModuleRegExp to prevent arm crash
For some reason the choice to use /^ {4} instead of four spaces is causing a crash
in Windows on Arm in V8 Regex parsing. Fix this by replacing with four actual
spaces to maintain functionality without a crash.
This will be reported upstream as it reproduces there.
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js
index 6174d62bb11643949bfb041db36b94f1998d0df9..97c9bc0c5af55b8961cd99ce24844664393b0dd5 100644
--- a/lib/internal/util/inspect.js
+++ b/lib/internal/util/inspect.js
@@ -206,7 +206,7 @@ const strEscapeSequencesReplacerSingle = /[\x00-\x1f\x5c\x7f-\x9f]|[\ud800-\udbf
const keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/;
const numberRegExp = /^(0|[1-9][0-9]*)$/;
-const coreModuleRegExp = /^ {4}at (?:[^/\\(]+ \(|)node:(.+):\d+:\d+\)?$/;
+const coreModuleRegExp = /^ at (?:[^/\\(]+ \(|)node:(.+):\d+:\d+\)?$/;
const nodeModulesRegExp = /[/\\]node_modules[/\\](.+?)(?=[/\\])/g;
const classRegExp = /^(\s+[^(]*?)\s*{/;