Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ufuzz failure #5745

Closed
alexlamsl opened this issue Nov 23, 2022 · 0 comments · Fixed by #5746
Closed

ufuzz failure #5745

alexlamsl opened this issue Nov 23, 2022 · 0 comments · Fixed by #5746
Labels

Comments

@alexlamsl
Copy link
Collaborator

// original code
// (beautified)
var _calls_ = 10, a = 100, b = 10, c = 0;

{
    var let_2;
    {
        var expr3 = [].next;
        for (var key3 in expr3) {
            c = 1 + c;
            let arguments = expr3[key3];
            {
                var undefined;
            }
        }
    }
}

{
    var brake6 = 5;
    do {
        --b + (a++ + (3 in [ -((a = (false != null) % (1 == 24..toString())) != ((a && (a[c = 1 + c, 
        +(-4 % "a" > 1 / "a")] &= [ , 0 ].length === 2 == "function")) & [] == ([ , 0 ].length === 2))), {
            3: a && a.a,
            value: a++ + (("object" <= "bar") << (Infinity != 1) && (a && (a.then = (NaN, 
            false) === (true && 4))))
        }.length, (this === ([ , 0 ].length === 2) != undefined * 25, "object" <= NaN || (undefined || -5)) ]) || a || 3).toString();
    } while (a && --brake6 > 0);
}

for (var brake8 = 5; --b + ((c = c + 1) + function(async_1) {
    L29891: for (var brake9 = 5; (c = c + 1) + (0 === 1 ? a : b) && brake9 > 0; --brake9) {}
}() ? /[abc4]/g.exec((a++ + a-- || b || 5).toString()) : --b + (typeof f1 == "function" && --_calls_ >= 0 && f1(2))) && brake8 > 0; --brake8) {
    (c = c + 1) + {
        var: a && typeof a.c == "function" && --_calls_ >= 0 && a.c(delete b),
        undefined: --b + void (a && (a.undefined = (4 ^ undefined) > ([], 4) && (-1 == import.meta) >= -4 + null)),
        1.5: typeof f1 == "function" && --_calls_ >= 0 && f1(null, (c = c + 1) + (typeof f1 == "function" && --_calls_ >= 0 && f1(Infinity, 5)), -2)
    }.undefined;
}

console.log(null, a, b, c, Infinity, NaN, undefined);
// uglified code
// (beautified)
var t, n = 10, f = 100, o = 10, e = 0, i = [].next;

for (t in i) {
    e = 1 + e;
    let arguments = i[t], n;
}

for (var c = 5; --o, (f++ + (3 in [ -((f = !0 % (1 == 24..toString())) != ((f && (f[e = 1 + e, 
0] &= 2 === [ , 0 ].length == "function")) & [] == (2 === [ , 0 ].length))), {
    3: f && f.a,
    value: f++ + (!1 << (1 != Infinity) && f && (f.then = 4 === (NaN, !1)))
}.length, "object" <= NaN || -5 ]) || f || 3).toString(), f && 0 < --c; ) {}

for (var l = 5; --o + ((e += 1) + function() {
    for (var n = 5; (e += 1) + o && 0 < n; --n) {}
}() ? /[abc4]/g.exec((f++ + f-- || o || 5).toString()) : --o + ("function" == typeof f1 && 0 <= --n && f1(2))) && 0 < l; --l) {
    e += 1, f && "function" == typeof f.c && 0 <= --n && f.c(delete o), --o, f && (f.undefined = !1), 
    "function" == typeof f1 && 0 <= --n && f1(null, (e += 1) + ("function" == typeof f1 && 0 <= --n && f1(Infinity, 5)), -2);
}

console.log(null, f, o, e, Infinity, NaN, h);
original result:
null NaN -8 47 Infinity NaN undefined

uglified result:
evalmachine.<anonymous>:2
var t,n=10,f=100,o=10,e=0,i=[].next;for(t in i){e=1+e;let arguments=i[t],n}for(var c=5;--o,(f+++(3 in[-((f=!0%(1==24..toString()))!=((f&&(f[e=1+e,0]&=2===[,0].length=="function"))&[]==(2===[,0].length))),{3:f&&f.a,value:f+++(!1<<(1!=Infinity)&&f&&(f.then=4===(NaN,!1)))}.length,"object"<=NaN||-5])||f||3).toString(),f&&0<--c;);for(var l=5;--o+((e+=1)+function(){for(var n=5;(e+=1)+o&&0<n;--n);}()?/[abc4]/g.exec((f+++f--||o||5).toString()):--o+("function"==typeof f1&&0<=--n&&f1(2)))&&0<l;--l)e+=1,f&&"function"==typeof f.c&&0<=--n&&f.c(delete o),--o,f&&(f.undefined=!1),"function"==typeof f1&&0<=--n&&f1(null,(e+=1)+("function"==typeof f1&&0<=--n&&f1(Infinity,5)),-2);console.log(null,f,o,e,Infinity,NaN,h);
                                                                                                                                                                                                                                                                                               

ReferenceError: h is not defined
    at evalmachine.<anonymous>:2:706
    at evalmachine.<anonymous>:3:3
    at ContextifyScript.Script.runInContext (vm.js:59:29)
    at Object.runInContext (vm.js:120:6)
    at run_code_vm (/home/runner/work/UglifyJS/UglifyJS/test/sandbox.js:263:12)
    at Object.exports.run_code (/home/runner/work/UglifyJS/UglifyJS/test/sandbox.js:36:38)
    at run_code (/home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2122:20)
    at /home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2577:29
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2564:20)
// reduced test case (output will differ)

// (beautified)
{
    let arguments;
    var undefined;
}

undefined;

0(undefined);
// output: TypeError: 0 is not a function
// minify: ReferenceError: a is not defined
// options: {
//   "ie": true,
//   "module": false,
//   "toplevel": true,
//   "mangle": {
//     "v8": true
//   },
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "ie": true,
  "module": false,
  "toplevel": true,
  "mangle": {
    "v8": true
  },
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  join_vars
  reduce_vars
  toplevel

Suspicious options:
  rename
  toplevel
@alexlamsl alexlamsl added the bug label Nov 23, 2022
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Nov 23, 2022
alexlamsl added a commit that referenced this issue Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant