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

Closed
alexlamsl opened this issue Dec 30, 2019 · 0 comments · Fixed by #3659
Closed

ufuzz failure #3658

alexlamsl opened this issue Dec 30, 2019 · 0 comments · Fixed by #3659
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0() {
    {
        var brake1 = 5;
        while ((c = c + 1) + (a++ + ([ a++ + -(("number" & null) >= ("object" ^ 3) | [ , 0 ][1] % {} ^ false == this), /[abc4]/.test((a++ + !function() {
            if (c = 1 + c, this + -2 < (undefined && 2) !== (38..toString() <= [ , 0 ][1]) / (3 << [])) {
                c = 1 + c, (22 || []) < (true !== null) | (this === ([ , 0 ].length === 2)) > (24..toString() === /[a2][^e]+$/);
            } else {
                c = 1 + c, -((c = c + 1, -4) || -2 & NaN);
            }
            if (c = 1 + c, (-0 + 2 << ("object" | "foo")) % ((c = c + 1, -0) < 23..toString() % -2)) {
                c = 1 + c, 0 * undefined >> (a += [] | "number") << (Infinity ^ -5) / (this | 25);
            } else {
                c = 1 + c, a && (a.Infinity = -(5 | undefined) || a && (a[a++ + (b = a)] = ("c" === [ , 0 ][1]) <= ("c" | 3)));
            }
            c = c + 1;
        }() || b || 5).toString()) ] ? a++ + {
            1.5: --b + ((38..toString() === -5) >= (NaN < /[a2][^e]+$/) >= (a && (a[typeof bar_1 !== "boolean"] = (a = "function" << 38..toString()) || undefined | -1))),
            foo: --b + (typeof f2 == "function" && --_calls_ >= 0 && f2()),
            null: b = a
        }.in : (c = c + 1) + (typeof a == "function" && --_calls_ >= 0 && a() || a || 3).toString()) || 1).toString()[--b + (1 === 1 ? a : b)] && --brake1 > 0) {
            try {
                {
                    {
                        var expr12 = a++ + (0 === 1 ? a : b);
                        for (var key12 in expr12) {
                            [ 0 === 1 ? a : b, (-0 << -3 != (a = -0 > -5)) / (0 < "foo" && (this || "c")) ][(-0 || 8).toString()[a++ + ((a && (a.null = "" - "c") || -1 === 24..toString()) !== (5 >>> ([ , 0 ].length === 2), 
                            "c" % 22))]];
                        }
                    }
                }
            } catch (Math_1) {
                var undefined_2 = Math_1, foo = --b + (typeof f0 == "function" && --_calls_ >= 0 && f0(typeof f1 == "function" && --_calls_ >= 0 && f1(), (c = c + 1) + (typeof Math_1 == "function" && --_calls_ >= 0 && Math_1(-4, --b + (typeof f2 == "function" && --_calls_ >= 0 && f2(4)), -(([ , 0 ][1] * [] == !"b") >> ((c = c + 1, 
                this) >>> 25 * [ , 0 ][1])))), a++ + (b = a)));
                var undefined_2_2;
            }
        }
    }
    {
        {
            return -1;
        }
        return;
    }
}

var b = f0("bar");

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

u = function o() {
    for (var n = 5; (a += 1) + ("" + (r++ + (r++, r++, function() {
        a = 1 + a, this + -2 < void 0 !== 0 ? a = 1 + a : (a = 1 + a, a += 1), a = 1 + a, 
        2 % (a += 1, !0) ? (a = 1 + a, r += 0) : (a = 1 + a, r && (r.Infinity = -5)), a += 1;
    }(), r++ + {
        1.5: --u + ((r && (r["boolean" != typeof bar_1] = (r = 0) || -1)) <= !0),
        foo: --u + ("function" == typeof f2 && 0 <= --i && f2()),
        null: u = r
    }.in) || 1))[--u + r] && 0 < --n; ) {
        try {
            var f = r++ + u;
            for (var t in f) {
                r = !0, ++r && (r.null = NaN);
            }
        } catch (n) {
            --u, 0 <= --i && o("function" == typeof f1 && 0 <= --i && f1(), (a += 1, "function" == typeof n && 0 <= --i && n(-4, --u + ("function" == typeof f2 && 0 <= --i && f2(4)), -(!0 >> (a += 1, 
            this >>> 0)))), u = ++r);
        }
    }
    return 1;
}(), console.log(null, r, u, a, 1 / 0, NaN, void 0);
original result:
null 0 -1 7 Infinity NaN undefined

uglified result:
null 0 1 7 Infinity NaN undefined

minify(options):
{
  "compress": {
    "passes": 1000000,
    "unsafe": true
  },
  "toplevel": true
}
@alexlamsl alexlamsl added the bug label Dec 30, 2019
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Dec 30, 2019
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Dec 30, 2019
alexlamsl added a commit that referenced this issue Dec 31, 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