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 on reduce_vars #2992

Closed
alexlamsl opened this issue Mar 11, 2018 · 0 comments · Fixed by #2993
Closed

ufuzz failure on reduce_vars #2992

alexlamsl opened this issue Mar 11, 2018 · 0 comments · Fixed by #2993
Labels

Comments

@alexlamsl
Copy link
Collaborator

https://travis-ci.org/alexlamsl/UglifyJS2/builds/351812338

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

function f0(bar_2, b_1) {
    {
        var brake1 = 5;
        do {
            {
            }
        } while (--b + /[abc4]/.test((typeof bar_2_2 !== "function" || b || 5).toString()) && --brake1 > 0);
    }
    switch (typeof f0 == "function" && --_calls_ >= 0 && f0((c = c + 1) + (typeof b_1 == "function" && --_calls_ >= 0 && b_1()))) {
      case a++ + b--:
        break;

      case b_1:
        try {
            L15417: {}
        } catch (b) {
            {
                var expr8 = a++ + !function() {}();
                L15418: for (var key8 in expr8) {
                    c = 1 + c;
                    var foo_1 = expr8[key8];
                    c = c + 1;
                }
            }
            {
                var Infinity_2 = function f1() {
                    {
                        return a++ + ~a;
                    }
                }(--b + (0 === 1 ? a : b), --b);
            }
        }

      case [].Infinity:
      case ~((bar_2 = ~[ , 0 ][1] - 38..toString() * 24..toString()) == ((c = c + 1, "a") !== 4 >= true)):
        L15419: for (var brake13 = 5; (c = c + 1) + (typeof b_1 == "function" && --_calls_ >= 0 && b_1("b", (foo_1 && (foo_1[(c = 1 + c, 
        (-4 & 22) - (22 >> -3) ^ (b_1 && (b_1[(c = 1 + c, ({} ^ Infinity) >= (-4 != "a") >= (("undefined", 
        Infinity) >= ("object" && "number")))] = "number" >>> 38..toString())) != (NaN == 24..toString()))] = [ , 0 ][1] > "")) >= (5 !== "bar") || (b_1 = null % -5 >>> (5 << "bar")), [ , 0 ][1])) && brake13 > 0; --brake13) {
            c = c + 1;
        }
        {
            var Infinity_2 = function b_2() {
                {
                    var brake16 = 5;
                    do {
                        ("bar" ^ 2 && [ , 0 ].length === 2 == null) <= ((null && -4) >= "bar" >> 5);
                    } while (--b + b-- && --brake16 > 0);
                }
                for (var brake18 = 5; --b + (typeof bar_2 == "function" && --_calls_ >= 0 && bar_2(undefined, [ , 0 ].length === 2)) && brake18 > 0; --brake18) {
                    try {
                    } finally {
                        c = 1 + c, ((-4 & null) != (bar_2 && (bar_2[(c = 1 + c, ("bar" >= -3) + (this << true) << ("bar" >>> 3 >> "c" * 3))] = /[a2][^e]+$/ && 22))) >> (b_1 && (b_1.foo %= "number" == -5 ^ -4 >>> 4));
                        {
                        }
                    }
                }
            }(-3, [ , 0 ].length === 2, --b + (b + 1 - .1 - .1 - .1));
        }
        break;
    }
}

var undefined_1 = f0([ , 0 ][1]);

console.log(null, a, b, c, Infinity, NaN, undefined);
// uglified code
// (beautified)
var _calls_ = 10, a = 100, b = 10, c = 0;

function f0(o, f) {
    var n = 5;
    do {} while (--b + /[abc4]/.test(("function" != typeof bar_2_2 || b || 5).toString()) && 0 < --n);
    switch ("function" == typeof f0 && 0 <= --_calls_ && f0((c += 1) + ("function" == typeof f && 0 <= --_calls_ && f()))) {
      case a++ + b--:
        break;

      case f:
      case [].Infinity:
      case ~(-913 == (!0 !== (c += 1, "a"))):
        for (var t = 5; (c += 1) + ("function" == typeof f && 0 <= --_calls_ && f("b", f = 0, 0)) && 0 < t; --t) {
            c += 1;
        }
        !function() {
            var a = 5;
            do {} while (--b + b-- && 0 < --a);
            for (var o = 5; --b + !1 && 0 < o; --o) {
                c = 1 + (c = 1 + c), f && (f.foo %= 268435455);
            }
        }(--b);
    }
}

var undefined_1 = f0(0);

console.log(null, a, b, c, 1 / 0, NaN, void 0);
original result:
null 111 -226 216 Infinity NaN undefined

uglified result:
null 111 -226 221 Infinity NaN undefined

minify(options):
{
  "compress": {
    "keep_fargs": false,
    "passes": 1000000,
    "sequences": 1000000,
    "unsafe": true,
    "unsafe_Function": true,
    "unsafe_math": true,
    "unsafe_proto": true,
    "unsafe_regexp": true
  }
}

Suspicious compress options:
  evaluate
  passes
  reduce_vars
  unsafe
@alexlamsl alexlamsl added the bug label Mar 11, 2018
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Mar 11, 2018
alexlamsl added a commit that referenced this issue Mar 11, 2018
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