GeezerVison is showing github.com — lib: limit split function calls to prevent excessive array length · nodejs/node@fda56b9
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/blob.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -360,7 +360,7 @@ function resolveObjectURL(url) { | 360 | 360 | try { | 361 | 361 | const parsed = new URL(url); | 362 | 362 |
| 363 | | - const split = StringPrototypeSplit(parsed.pathname, ':'); | | 363 | + const split = StringPrototypeSplit(parsed.pathname, ':', 3); | 364 | 364 |
| 365 | 365 | if (split.length !== 2) | 366 | 366 | return; | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/debugger/inspect.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -160,7 +160,7 @@ class NodeInspector { | 160 | 160 | this[domain] = createAgentProxy(domain, this.client); | 161 | 161 | }); | 162 | 162 | this.handleDebugEvent = (fullName, params) => { | 163 | | - const { 0: domain, 1: name } = StringPrototypeSplit(fullName, '.'); | | 163 | + const { 0: domain, 1: name } = StringPrototypeSplit(fullName, '.', 2); | 164 | 164 | if (domain in this) { | 165 | 165 | this[domain].emit(name, params); | 166 | 166 | } | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/errors.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -907,7 +907,7 @@ const fatalExceptionStackEnhancers = { | 907 | 907 | // ANSI escape sequences is not reliable. | 908 | 908 | if (isWindows) { | 909 | 909 | const info = internalBinding('os').getOSInformation(); | 910 | | - const ver = ArrayPrototypeMap(StringPrototypeSplit(info[2], '.'), | | 910 | + const ver = ArrayPrototypeMap(StringPrototypeSplit(info[2], '.', 3), | 911 | 911 | Number); | 912 | 912 | if (ver[0] !== 10 || ver[2] < 14393) { | 913 | 913 | useColors = false; | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/loader.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1833,7 +1833,7 @@ function reconstructErrorStack(err, parentPath, parentSource) { | 1833 | 1833 | const { 1: line, 2: col } = | 1834 | 1834 | RegExpPrototypeExec(/(\d+):(\d+)\)/, errLine) || []; | 1835 | 1835 | if (line && col) { | 1836 | | - const srcLine = StringPrototypeSplit(parentSource, '\n')[line - 1]; | | 1836 | + const srcLine = StringPrototypeSplit(parentSource, '\n', line)[line - 1]; | 1837 | 1837 | const frame = `${parentPath}:${line}\n${srcLine}\n${StringPrototypeRepeat(' ', col - 1)}^\n`; | 1838 | 1838 | setArrowMessage(err, frame); | 1839 | 1839 | } | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/modules/esm/module_job.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -190,7 +190,7 @@ class ModuleJob extends ModuleJobBase { | 190 | 190 | if (!getSourceMapsSupport().enabled && | 191 | 191 | StringPrototypeIncludes(e.message, | 192 | 192 | ' does not provide an export named')) { | 193 | | - const splitStack = StringPrototypeSplit(e.stack, '\n'); | | 193 | + const splitStack = StringPrototypeSplit(e.stack, '\n', 2); | 194 | 194 | const parentFileUrl = RegExpPrototypeSymbolReplace( | 195 | 195 | /:\d+$/, | 196 | 196 | splitStack[0], | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/repl/await.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -178,7 +178,7 @@ function processTopLevelAwait(src) { | 178 | 178 | return null; | 179 | 179 | const line = e.loc.line; | 180 | 180 | const column = line === 1 ? e.loc.column - wrapPrefix.length : e.loc.column; | 181 | | - let message = '\n' + StringPrototypeSplit(src, '\n')[line - 1] + '\n' + | | 181 | + let message = '\n' + StringPrototypeSplit(src, '\n', line)[line - 1] + '\n' + | 182 | 182 | StringPrototypeRepeat(' ', column) + | 183 | 183 | '^\n\n' + RegExpPrototypeSymbolReplace(/ \([^)]+\)/, e.message, ''); | 184 | 184 | // V8 unexpected token errors include the token string. | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/source_map/source_map_cache.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -292,7 +292,7 @@ function sourceMapFromFile(mapURL) { | 292 | 292 | // data:[<mediatype>][;base64],<data> see: | 293 | 293 | // https://tools.ietf.org/html/rfc2397#section-2 | 294 | 294 | function sourceMapFromDataUrl(sourceURL, url) { | 295 | | - const { 0: format, 1: data } = StringPrototypeSplit(url, ','); | | 295 | + const { 0: format, 1: data } = StringPrototypeSplit(url, ',', 2); | 296 | 296 | const splitFormat = StringPrototypeSplit(format, ';'); | 297 | 297 | const contentType = splitFormat[0]; | 298 | 298 | const base64 = splitFormat[splitFormat.length - 1] === 'base64'; | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/test_runner/utils.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -263,7 +263,7 @@ function parseCommandLine() { | 263 | 263 | ); | 264 | 264 | } | 265 | 265 |
| 266 | | - const indexAndTotal = StringPrototypeSplit(shardOption, '/'); | | 266 | + const indexAndTotal = StringPrototypeSplit(shardOption, '/', 2); | 267 | 267 | shard = { | 268 | 268 | __proto__: null, | 269 | 269 | index: NumberParseInt(indexAndTotal[0], 10), | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/tty.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -138,7 +138,7 @@ function getColorDepth(env = process.env) { | 138 | 138 | // Lazy load for startup performance. | 139 | 139 | if (OSRelease === undefined) { | 140 | 140 | const { release } = require('os'); | 141 | | - OSRelease = StringPrototypeSplit(release(), '.'); | | 141 | + OSRelease = StringPrototypeSplit(release(), '.', 3); | 142 | 142 | } | 143 | 143 | // Windows 10 build 10586 is the first Windows release that supports 256 | 144 | 144 | // colors. Windows 10 build 14931 is the first release that supports | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/util/debuglog.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -160,6 +160,7 @@ function formatTime(ms) { | 160 | 160 | ({ 0: seconds, 1: ms } = StringPrototypeSplit( | 161 | 161 | NumberPrototypeToFixed(seconds, 3), | 162 | 162 | '.', | | 163 | + 2, | 163 | 164 | )); | 164 | 165 | const res = hours !== 0 ? `${hours}:${pad(minutes)}` : minutes; | 165 | 166 | return `${res}:${pad(seconds)}.${ms} (${hours !== 0 ? 'h:m' : ''}m:ss.mmm)`; | |
|