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

Closed
alexlamsl opened this issue Dec 10, 2019 · 0 comments · Fixed by #3632
Closed

ufuzz failure #3631

alexlamsl opened this issue Dec 10, 2019 · 0 comments · Fixed by #3632
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

(c = c + 1) + (typeof a == "function" && --_calls_ >= 0 && a(--b + ((-4 >>> NaN) / (null !== 0) | (-2 === -4) > (0 ^ 4)), (c = c + 1) + (a && a[-((-3 + -0 > "b" >>> -1) % ((-4 < null) >> ("object" >= 25)))]) ? (c = c + 1) + true : {
    foo: (c = c + 1) + a,
    "": (c = c + 1) + void function() {
        c = c + 1;
    }(),
    1.5: a++ + void b,
    set null(a_2) {
        try {
            if (--b + (a_2 |= (c = 1 + c, (a_2 >>>= "object" - NaN) <= ("b" ^ -0) | (/[a2][^e]+$/ | [ , 0 ].length === 2) != false + {}))) {
                var expr5 = (c = 1 + c, (0 !== 24..toString()) >> (22 | "number") <= (a_2 && (a_2[b = a] /= 2 >>> true ^ -2 >> -3)));
                L20933: for (var key5 in expr5) {
                    c = 1 + c;
                    var arguments = expr5[key5];
                    c = 1 + c, ((23..toString() == 22) >= (38..toString() < NaN)) >>> (c = c + 1, Infinity || -5);
                }
            } else {
                var brake7 = 5;
                L20934: while ((c = 1 + c, (a_2 &= -5 >>> "number" & (23..toString() || 4)) === (23..toString() > 4) >> ("function" != -4)) && --brake7 > 0) {
                    c = 1 + c, ((2 | 24..toString()) + (-4 === 2)) * (4 < false | 3 == 3);
                }
            }
        } catch (foo_1) {
            try {
                c = 1 + c, ([], [ , 0 ][1]) / !38..toString() <= ({} - [ , 0 ][1] !== (true, -3));
            } catch (Math_1) {
            } finally {
            }
            c = c + 1;
        }
        this.Infinity += (a_2 && (a_2[a++ + [][b = a]] = ((22 | 1) + (NaN < true) ^ ~(Infinity * "a")) & (a_2 = "foo" && "foo") << (-1 | "") << ("object" * "function" || 2 & "undefined"))) < ((-2 != "" && {} >> 3) | (a_2 && (a_2[typeof f1 == "function" && --_calls_ >= 0 && f1(3, -4)] = null - "b" >>> (a_2 += "" >> 3)))) >> ((a_2 = ("foo" !== 2) / (NaN !== -4)) && (c = c + 1, 
        a_2 && (a_2[c = 1 + c, (/[a2][^e]+$/ <= 23..toString() >= void 22) / ((a_2 && (a_2.a /= 5 < [ , 0 ][1])) >= (24..toString(), 
        ""))] = "c" * 2)));
    },
    3: --b + ((c = c + 1) + [ --b + (typeof f0 == "function" && --_calls_ >= 0 && f0(true, 22, 3)), b += a ].null ? typeof a == "function" && --_calls_ >= 0 && a() : (a++ + (a = (c = c + 1) + ((c = 1 + c, 
    (a && (a.null += (c = c + 1, undefined) * ("b" >> 24..toString()))) | ([ , 0 ].length === 2 | NaN) !== ([ , 0 ][1] ^ 25)) ? (c = 1 + c, 
    (c = c + 1, 22 && "undefined") < (23..toString() - 1 && 22 * 23..toString())) : (c = 1 + c, 
    ("" & null) >>> (2 >= 0) !== -5 % 1 >> (a && (a.null = 3 / [ , 0 ][1]))))) || 1).toString()[--b + (typeof a == "function" && --_calls_ >= 0 && a(/[a2][^e]+$/, (c = 1 + c, 
    (("foo" && "c") !== (-0 & this)) * (([] !== 5) >= (-0 || 24..toString()))), (c = 1 + c, 
    {} === "function" !== ([ , 0 ].length === 2 || "function") | "foo" * false != (5 === undefined))))])
}, -3));

L20935: {
    {
        var brake15 = 5;
        L20936: do {
            L20937: {
                {
                    var brake17 = 5;
                    do {
                        {
                            continue L20936;
                            {
                                var expr20 = a++ + (b + 1 - .1 - .1 - .1);
                                for (var key20 in expr20) {
                                    {
                                        var expr21 = a;
                                        for (var key21 in expr21) {
                                            {
                                                var brake22 = 5;
                                                do {
                                                    c = 1 + c, ("object" !== this) <= this % this && ([] > "number") - ({} + -1);
                                                } while ((c = 1 + c, a && (a[a++ + void ((null >> "bar") / (1 || "undefined") < (24..toString() || -3, 
                                                undefined > undefined))] = 1 / -4 >= ("function" || [ , 0 ].length === 2) === (c = c + 1, 
                                                23..toString()) <= (-3 != "a"))) && --brake22 > 0);
                                            }
                                        }
                                    }
                                }
                            }
                            a;
                            var b_2 = (c = c + 1) + typeof (a++ + /[abc4]/.test(((c = 1 + c, ((b_2 && (b_2[c = 1 + c, 
                            (undefined % ([ , 0 ].length === 2) != ("function" == 2)) % (("bar" || -1) < ([ , 0 ][1] ^ false))] = "undefined" ^ undefined)) ^ (b_2 /= "bar" >>> "b")) >>> ((Infinity, 
                            []) < (3 ^ this))) || b || 5).toString()));
                        }
                    } while (a++ && --brake17 > 0);
                }
                {
                    {
                        var expr27 = ++a;
                        for (var key27 in expr27) {
                            c = 1 + c;
                            var b_2_2 = expr27[key27];
                            var NaN;
                        }
                    }
                    b_2 = -5 % 38..toString() || [ , 0 ][1] === "object" || ("c" || 5) === NaN >= "c";
                }
                var undefined = --b + (b_2_2 && b_2_2.null);
                for (var brake31 = 5; b++ && brake31 > 0; --brake31) {
                    (c = c + 1) + [ , typeof b_2_2 == "function" && --_calls_ >= 0 && b_2_2(-1), a++ + --b, a++ + /[abc4]/.test((/[abc4]/.test(((c = 1 + c, 
                    "bar" % 2 % (0 + -4) && ([ , 0 ][1] != "a") << true - undefined) || b || 5).toString()) || b || 5).toString()) ].a;
                }
            }
        } while (("b" + "undefined" ^ (b_2 && (b_2[c = 1 + c, (Infinity | "c") - (Infinity + -4) > ((b_2_2 += -2 && "number") ^ null < "")] = ([ , 0 ].length === 2) >= 0)) || ((b_2_2 -= "number" === -1) || "b" >= "object")) && --brake15 > 0);
    }
    {
        var expr33 = --b + {
            3: "undefined",
            1.5: a++ + delete ((0 <= 25) / (-3 === 2) + (b_1 += (NaN <= "foo") + (-2 == "object")))
        };
        L20938: for (var key33 in expr33) {
            c = 1 + c;
            var b_1 = expr33[key33];
            (c = c + 1) + (typeof b_1 == "function" && --_calls_ >= 0 && b_1());
        }
    }
}

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

e += 1, "function" == typeof a && 0 <= --t && a(--r - 4, (e += 1) + (a && a[-0]) ? (e += 1) + !0 : {
    foo: (e += 1) + a,
    "": (e += 1) + void (e += 1),
    1.5: a++ + void 0,
    set null(n) {
        try {
            if (--r + (n |= (e = 1 + e, (n >>>= NaN) <= 0 | !0))) {
                var o = (e = 1 + e, 0 <= (n && (n[r = a] /= -2)));
                for (var f in o) {
                    e = 1 + (1 + e), e += 1;
                }
            } else {
                for (var i = 5; e = 1 + e, 0 == (n &= 19) && 0 < --i; ) {
                    e = 1 + e;
                }
            }
        } catch (n) {
            try {
                e = 1 + e;
            } catch (n) {}
            e += 1;
        }
        this.Infinity += (n && (n[a++ + [][r = a]] = -24 & (n = "foo") << -1 << 0)) < (0 | (n && (n["function" == typeof f1 && 0 <= --t && f1(3, -4)] = NaN >>> (n += 0)))) >> ((n = 1) && (e += 1, 
        n && (n[e = 1 + e, !1 / ("" <= (n && (n.a /= !1)))] = NaN)));
    },
    3: --r + ((e += 1) + [ --r + ("function" == typeof f0 && 0 <= --t && f0(!0, 22, 3)), r += a ].null ? "function" == typeof a && 0 <= --t && a() : ("" + (a++ + (a = (e += 1) + (e = 1 + e, 
    !0 | (a && (a.null += 0 * (e += 1, u))) ? (e = 1 + e, e += 1, !1) : (e = 1 + e, 
    0 != -0 >> (a && (a.null = 1 / 0))))) || 1))[--r + ("function" == typeof a && 0 <= --t && a(/[a2][^e]+$/, !1 * ("c" !== (-0 & this)), (e = 1 + (1 + e), 
    !0 | NaN != (5 === u))))])
}, -3);

var n = 5;

n: do {
    var o = 5;
    do {
        continue n;
    } while (a++ && 0 < --o);
    var f = ++a;
    for (var i in f) {
        e = 1 + e;
        var l = f[i];
    }
    for (var u = --r + (l && l.null), v = 5; r++ && 0 < v; --v) {
        e += 1, "function" == typeof l && 0 <= --t && l(-1), a++, --r, a++, e = 1 + e;
    }
} while (("bundefined" ^ ((-5)[e = 1 + e, -1 / 0 > (!1 ^ (l += "number"))] = !0) || (l -= !1)) && 0 < --n);

var c = --r + {
    3: "undefined",
    1.5: a++ + (d += 0, !0)
};

for (var y in c) {
    e = 1 + e;
    var d = c[y];
    e += 1, "function" == typeof d && 0 <= --t && d();
}

console.log(null, a, r, e, 1 / 0, void 0, u);
original result:
null 101 9 33 Infinity undefined undefined

uglified result:
null 101 9 38 Infinity undefined undefined

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