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 #3600

Closed
alexlamsl opened this issue Nov 19, 2019 · 0 comments · Fixed by #3601
Closed

ufuzz failure #3600

alexlamsl opened this issue Nov 19, 2019 · 0 comments · Fixed by #3601
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0(b_2) {
    if (--b + [ (c = c + 1) + (typeof b_2 == "function" && --_calls_ >= 0 && b_2(--b + ((-2 ^ "bar") != 1 - -3 | -(false === "undefined")))), ++a ][--b + (a++ + {
        undefined: typeof b_2 == "function" && --_calls_ >= 0 && b_2(-4),
        in: (c = c + 1) + (b_2 && (b_2[b_2 && b_2.in ? 1 === 1 ? a : b : b++] += (c = c + 1, 
        "foo") === (c = c + 1, []) == (23..toString() + 23..toString()) * (b_2 && (b_2[c = 1 + c, 
        ((-5 && 2) ^ (4 ^ "object")) % (-2 << 5 !== 1 << ([ , 0 ].length === 2))] += true !== 2)))),
        "\t": -("number" >> true && undefined === -4 || b_2 && (b_2.b = (b_2 && (b_2[c = 1 + c, 
        (this === 5) < "" - "function" != 2 / 4 % (-4 || 4)] &= -1 % null)) < (-5, -3))),
        null: [ (c = c + 1) + [][b ^= a], (a++ + 0 || a || 3).toString(), a++ + (b += a) ][a++ + /[abc4]/.test((b-- || b || 5).toString())],
        length: a++
    }[a++ + (b += a)] || 5).toString()[(c = c + 1) + (typeof b_2 == "function" && --_calls_ >= 0 && b_2(22, 2))]]) {
        var b_1 = function bar(a_1, arguments) {
            try {
                var arguments_1 = a++ + typeof b_2;
            } catch (undefined_1) {
                c = c + 1;
                {
                    var brake6 = 5;
                    L17325: while (--b + (typeof f0 == "function" && --_calls_ >= 0 && f0(true, [ , 0 ].length === 2)) && --brake6 > 0) {}
                }
            }
            {
                c = c + 1;
                {
                    var brake10 = 5;
                    while (arguments_1 && arguments_1.foo && --brake10 > 0) {
                        return 0 === 1 ? a : b;
                    }
                }
                {}
            }
        }(typeof void a);
    } else {
        return;
        (c = c + 1) + (-3 >> 5 >>> (null > "c") || (c = c + 1, "bar" || "foo"));
    }
    L17326: {
        return void function() {
            c = c + 1;
            var b = --b + ([ (c = 1 + c, (b_1 && (b_1.var += 38..toString() & "c")) >> ("b" << "c") > (null + -5 < (undefined !== "a"))), (c = 1 + c, 
            -("" | -1, 3, 0)) ].undefined || a || 3).toString(), b_2 = (c = c + 1) + -((-3 / [] | "foo" == "a") < (b_2 = void null << ("a" ^ -4)));
            {
                return +a;
            }
        }();
        {
            var expr20 = --b + (b_1 && (b_1.b = ((24..toString() || -0) | (b_2 = 22 ^ -2)) >= (5 !== 4 ^ {} << 22)));
            for (var key20 in expr20) {
                L17327: for (var brake21 = 5; typeof f1 == "function" && --_calls_ >= 0 && f1(undefined, "foo", typeof f2 == "function" && --_calls_ >= 0 && f2()) && brake21 > 0; --brake21) {
                    L17328: for (var brake22 = 5; b-- && brake22 > 0; --brake22) {
                        var bar_1 = {
                            NaN: a++ + (b_2 %= (c = 1 + c, ("foo" === 2) >> (-2 <= 4) > "c" / "number" / ("object" >>> 2))),
                            "-2": [].undefined,
                            1.5: --b + --a,
                            3: new function b_2() {
                                this.in = -4 >> 22;
                            }()
                        }.c, Math_2 = {
                            null: --b
                        }[null];
                    }
                }
            }
        }
    }
}

var b_1 = f0();

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

function f0(t) {
    if (--b + [ (c += 1) + ("function" == typeof t && 0 <= --_calls_ && t(1 + --b)), ++a ][--b + ("" + (a++ + {
        undefined: "function" == typeof t && 0 <= --_calls_ && t(-4),
        in: (c += 1) + (t && (t[t && t.in ? a : b++] += (c += 1, "foo" === (c += 1, []) == "2323" * (t && (t[c = 1 + c, 
        0] += !0))))),
        "\t": -(t && (t.b = (t && (t[c = 1 + c, (5 === this) < NaN != .5] &= NaN)) < -3)),
        null: [ (c += 1) + [][b ^= a], "" + (0 + a++ || a || 3), a++ + (b += ++a) ][a++ + /[abc4]/.test("" + (b-- || b || 5))],
        length: a++
    }[a++ + (b += ++a)] || 5))[(c += 1) + ("function" == typeof t && 0 <= --_calls_ && t(22, 2))]]) {
        var n = function() {
            try {
                var n = a++ + typeof t;
            } catch (a) {
                c += 1;
                for (var f = 5; --b + ("function" == typeof f0 && 0 <= --_calls_ && f0(!0, !0)) && 0 < --f; ) {}
            }
            c += 1;
            for (var o = 5; n && n.foo && 0 < --o; ) {
                return b;
            }
        }();
        r = --r + "" + ([ (c = 1 + (c + 1), !0 < (n && (n.var += 0)) >> 0), (c = 1 + c, 
        -0) ].undefined || a || 3), c += 1;
    }
    --b, c += 1, "function" == typeof t && 0 <= --_calls_ && t(1 + --b), ++a, --b, a++, 
    "function" == typeof t && 0 <= --_calls_ && t(-4), c += 1, t && (t[t && t.in ? a : b++] += (c += 1, 
    "foo" === (c += 1, []) == "2323" * (t && (t[c = 1 + c, 0] += !0)))), t && (t.b = (t && (t[c = 1 + c, 
    (5 === this) < NaN != .5] &= NaN)) < -3), c += 1, b ^= a, a++, b += ++a, a++, b--, 
    a++, b += ++a, c += 1, "function" == typeof t && 0 <= --_calls_ && t(22, 2);
}

var b_1 = f0();

console.log(null, a, b, c, 1 / 0, NaN, void 0);
original result:
null 107 320 4 Infinity NaN undefined

uglified result:
null 116 530 8 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
  }
}
@alexlamsl alexlamsl added the bug label Nov 19, 2019
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Nov 19, 2019
alexlamsl added a commit that referenced this issue Nov 19, 2019
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