question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maximum call stack size exceeded

See original GitHub issue

Please try the simple options below,

options: {
  identifierNamesGenerator: 'mangled-shuffled',
  reservedNames: ['.*'],
}

Obfuscator version used: 2.9.4

Stack trace

RangeError: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at o.isValidIdentifierName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledIdentifierNamesGenerator.ts:87:5)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledIdentifierNamesGenerator.ts:126:19)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledShuffledIdentifierNamesGenerator.ts:46:22)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledIdentifierNamesGenerator.ts:127:35)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledShuffledIdentifierNamesGenerator.ts:46:22)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledIdentifierNamesGenerator.ts:127:35)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledShuffledIdentifierNamesGenerator.ts:46:22)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledIdentifierNamesGenerator.ts:127:35)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledShuffledIdentifierNamesGenerator.ts:46:22)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledIdentifierNamesGenerator.ts:127:35)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledShuffledIdentifierNamesGenerator.ts:46:22)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledIdentifierNamesGenerator.ts:127:35)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledShuffledIdentifierNamesGenerator.ts:46:22)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledIdentifierNamesGenerator.ts:127:35)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledShuffledIdentifierNamesGenerator.ts:46:22)
    at o.generateNewMangledName (G:\XXX\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\generators\identifier-names-generators\MangledIdentifierNamesGenerator.ts:127:35)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! temten@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1

In src/generators/identifier-names-generators/MangledIdentifierNamesGenerators.ts line 231, function isValidIdentifierName (which is in src/generators/identifier-names-generators/AbstractIdentifierNamesGenerators.ts) excludes new mangled names that are matched with reservedNames. I think that’s the problem.

// src/generators/identifier-names-generators/MangledIdentifierNamesGenerators.ts
protected generateNewMangledName (previousMangledName: string): string {
  ...
  if (!this.isValidIdentifierName(newMangledName)) {
    newMangledName = this.generateNewMangledName(newMangledName);
  }

  return newMangledName;
}

// src/generators/identifier-names-generators/AbstractIdentifierNamesGenerators.ts
public isValidIdentifierName (name: string): boolean {
  return this.notReservedName(name) && !this.preservedNamesSet.has(name);
}

private notReservedName (name: string): boolean {
  return this.options.reservedNames.length
    ? !this.options.reservedNames.some((reservedName: string) =>
      new RegExp(reservedName, 'g').exec(name) !== null
    )
    : true;
}

In the document, reservedNames means something should not be obfuscated, in my case, .* means everything, then when you generate mangled names, you use reservedNames again for excluding, every mangled name will be excluded, it causes the dead loop.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Androbincommented, Jul 23, 2021

@sanex3339 eslint/eslint-scope#71 was released in v6.0.0

2reactions
sanex3339commented, Jul 21, 2021

Please wait until the official support. Even after eslint/eslint-scope#71 i will update #916 branch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Maximum call stack size exceeded error
It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you...
Read more >
JavaScript Error: Maximum Call Stack Size Exceeded
If you see the “Maximum Call Stack Size Exceeded” error, there's likely a problem with a recursive function within your JavaScript code.
Read more >
RangeError: Maximum call stack size exceeded - Educative.io
The most common source for this error is infinite recursion. You must have a recursive function in your code whose base case is...
Read more >
Uncaught RangeError: Maximum call ... - Net-Informations.Com
Maximum call stack size exceeded error ... This error is almost always means you have a problem with recursion in JavaScript code, as...
Read more >
How to fix: "RangeError: Maximum call stack size exceeded"
A "RangeError: Maximum call stack size exceeded" is an error that occurs when a function or operation tries to execute too many nested...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found