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.

[BUG] Lose Arguments

See original GitHub issue

Description

Hi there. I didn’t write on e-mail this time, because that just a bug report (ONE MORE KRUZYA 😄) So, I try obfuscate some code. I use plural-ru, but I think this isn’t trouble of plural-ru package.

So, in short description. If I right, obfuscator with next config:

{
    "controlFlowFlattening": true,
    "controlFlowFlatteningThreshold": 1.0,
}

Just lose a few arguments by spread operator. For more check examples.

Steps to reproduce

  1. Create function with spread operator (...some_array).
  2. Obfuscate with my settings.
  3. Profit.

Examples

Oh shit, here we go again…

Original:

// index.js | Я упростил код до 2 + 2. 
const plural = require("plural-ru");
const translate = ["Kruzya", "Is", "P..."];
plural(online, ...translate); // in this line I found bug, but go next...

Obfuscated:

_0x102640['HrGnp'](plural, online, ...translate); 

Function: image

How you can see, function can send only 3 arguments.

  • first: plural,
  • second: online,
  • third: array.

But in third argument we have a bug … because ...translate => arg1,arg2,arg3, …, argn (n = length of array). So, here we get 5 arguments, but sended only 3.

Result of this exec: image

This is a potential bug of obfuscator 👀

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sanex3339commented, Feb 28, 2021

Released as 2.10.5

0reactions
zeeker999commented, May 21, 2021

Found the minimal code to reproduce the issue:

function f(a, b, c, d) {
  console.log(a, b, c, d)
}

function g(...args) {
  f(...args, 5)
}
const a = [1, 2, 3]
g(...a, 4)

The output:

function f(e, h, i, j) {
    console['log'](e, h, i, j);
}
function g(...b) {
    const c = {
        'vtpEA': function (d, ...e, h) {
            return d(...e, h);
        }
    };
    c['vtpEA'](f, ...b, 0x5);
}
const a = [
    0x1,
    0x2,
    0x3
];
g(...a, 0x4);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug Patterns - Error Prone
Arguments to AutoValue constructor are in the wrong order. BadAnnotationImplementation. Classes that implement Annotation must override equals and hashCode.
Read more >
As Biotech Crops Lose Their Power, Scientists Push For New ...
Bt crops are losing their power. New strains of bollworms, rootworms, and other pests have emerged that are able to feed on Bt...
Read more >
Out arguments not carrying value upon exception - Studio
Hi,. I have tried this in latest version of UiPath as well as older version 2020.4, but it seems the bug still persists....
Read more >
A List Of Fallacious Arguments
Tonight I can't lose." This is Argument By. Generalization, but it assumes that small numbers are the same as big numbers. (Three sevens...
Read more >
Wrong arguments are passed to a program in debug mode
In order to fix the bug, the way arguments are treated was changed, as behaviour previously was pretty much undefined. The following guidelines...
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