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

Closed
alexlamsl opened this issue Dec 9, 2021 · 0 comments · Fixed by #5214
Closed

ufuzz failure #5213

alexlamsl opened this issue Dec 9, 2021 · 0 comments · Fixed by #5214
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

{
    var expr1 = (--b + (typeof f0 == "function" && --_calls_ >= 0 && f0(38..toString())) || a || 3).toString();
    L31360: for (var key1 in expr1) {
        c = 1 + c;
        var key1_1 = expr1[key1];
        L31361: {}
    }
}

{
    var brake3 = 5;
    while ((c = c + 1) + (a ^= (c = c + 1) + null) && --brake3 > 0) {
        L31362: {
            if (--b + ({
                [("b" % 25 < this + "b") << (4 === Infinity || ([ , 0 ].length === 2) * "")]: ++a,
                a: a >>>= a++ + ((a && (a.var += "" % -5 !== (23..toString() ^ NaN))) > (-3 && "number") << (false << -0)),
                0: 1 === 1 ? a : b,
                a: a,
                "\t": +((2 || 1) !== null * 0 || ("bar" === /[a2][^e]+$/) >>> ~-0)
            }[a && typeof a.async == "function" && --_calls_ >= 0 && a.async({
                static: a
            }.b, 4, --b + (a >>>= -(("bar" === 2 | "" < 38..toString()) == (c = c + 1, -3 - -2))))] ? typeof a == "function" && --_calls_ >= 0 && a(true, a++ + /[abc4]/.test(((c = c + 1) + delete (((null, 
            false) >>> false / "b") * ("number" << -5 && -4 == {})) || b || 5).toString()), "undefined") : {
                [typeof async_1 === "crap"]: {
                    value: a++ + "foo"
                }
            }[(c = c + 1) + (a && a[b >>>= a])])) {
                var expr6 = (--b + ({} in {
                    async: (c = c + 1) + (0 === 1 ? a : b)
                }) || 7).toString()[b >>>= a];
                L31363: for (a in expr6) {
                    {
                        var b_1 = function yield_1(foo_2, foo_1) {
                            function f0(a_2) {
                                c = 1 + c, 5 != -0 & -25 ^ false === 3 == (NaN, -3);
                                c = 1 + c, (foo_1 && (foo_1[(c = c + 1) + ((c = 1 + c, ~(a_2 && (a_2[-1 in {
                                    0: (c = 1 + c, (23..toString() > -0) << false + 23..toString() === (23..toString() >> 3 != (foo_2 && (foo_2[c = 1 + c, 
                                    ((foo_1 && (foo_1.get = true != 24..toString())) | undefined !== "object") === (true & 5 ^ (a_2 && (a_2[c = 1 + c, 
                                    (-4 === 5) > ("" > Infinity) >= (("number" ^ undefined) <= (a_2 += [ , 0 ][1] == 4))] >>>= [] & "number")))] = -5 - true))))
                                }] /= ("bar" >>> 38..toString()) - ({} << "undefined")))) ? (c = 1 + c, (4 << "") % (a_2 = -0 | 24..toString()) >> (foo_2 %= 3 >> "foo") + ("object" && 38..toString())) : (c = 1 + c, 
                                (-5 === -0, foo_1 && (foo_1[c = 1 + c, Infinity == -5 != (-2 ^ 25) ^ (foo_2 && (foo_2[c = 1 + c, 
                                (25 == -0) >> ([ , 0 ][1] === 5) >= "bar" / 38..toString() / ~38..toString()] = true >>> "a") || +"a")] = -1 != "c")) < (-4 != -3 === (c = c + 1, 
                                -5))))] = 38..toString() >> true << (-1 && null))) == (4 <= []) >>> 4 % 0;
                            }
                            var bar_1 = f0((c = 1 + c, ({} ^ /[a2][^e]+$/) >> (undefined < "function") == (bar_1 && (bar_1[(c = c + 1) + {
                                c: (c = 1 + c, !(2 << "bar") + -("bar", false)),
                                "\t": (c = 1 + c, ("object" * ([ , 0 ].length === 2) !== (bar_1 -= [] !== 0)) + ([ , 0 ][1] / 24..toString() ^ (bar_1 && (bar_1.async /= {} >> -2))))
                            }.value] = (foo_1 && (foo_1[c = 1 + c, ~(1 * 38..toString()) & null + -3 >= ("number" > null)] /= 0 / "object")) >= ~([ , 0 ].length === 2)))), 4, (c = 1 + c, 
                            (NaN && [ , 0 ].length === 2) != (false ^ 24..toString()) !== ([ , 0 ][1] == [ , 0 ][1] || "function" ^ -3)));
                            function f1(bar, foo_1_2) {
                                c = 1 + c, (foo_1_2 += (2 >> -3) % (null && [ , 0 ][1])) / (0 % "number" === [] % "");
                                c = 1 + c, (NaN >>> "bar" === (0 & "undefined")) << (-2 >> undefined <= (-5 || 5));
                            }
                            var b = f1([ , 0 ].length === 2);
                            function f2(a, await_1, foo_2) {
                                c = 1 + c, (/[a2][^e]+$/ ^ -5) > (foo_2 && (foo_2[c = 1 + c, -(2 >= 5) << ((a && (a.next *= "b" < false)) >>> ("c" == []))] = -3 == "undefined")), 
                                NaN % 1 ^ [ , 0 ][1] * -1;
                                c = 1 + c, NaN + 1 - false / undefined + ((-3 || -1) === +/[a2][^e]+$/);
                            }
                            var b_1 = f2();
                            function f3([ foo_2_1 ]) {
                            }
                            var arguments_1 = f3([ "b", -3, (c = 1 + c, -("bar" >= true) >> (("function" ^ "undefined") <= (38..toString() !== "function"))) ]);
                            function f4(let_2) {
                            }
                            var foo_1_2 = f4((c = 1 + c, (bar_1 && (bar_1.done = (c = c + 1, "number") !== ({} == "number"))) * ((c = c + 1, 
                            NaN) | false == 1)), (c = 1 + c, (this - {} ^ (c = c + 1, this)) > ("" >> "foo" ^ Infinity !== 1)));
                        }();
                    }
                }
            }
        }
    }
}

console.log(null, a, b, c, Infinity, NaN, undefined);
// uglified code
// (beautified)
var key1, _calls_ = 10, a = 100, b = 10, c = 0, expr1 = (--b + ("function" == typeof f0 && 0 <= --_calls_ && f0(38..toString())) || a || 3).toString();

for (key1 in expr1) {
    var c = 1 + c, key1_1 = expr1[key1];
}

for (var brake3 = 5; (c += 1) + (a ^= (c += 1) + null) && 0 < --brake3; ) {
    if (--b + ({
        [(NaN < this + "b") << "" * (2 === [ , 0 ].length)]: ++a,
        0: a,
        a: a >>>= a++ + (0 < (a && (a.var += 0 != (NaN ^ 23..toString())))),
        "\t": 1
    }[a && "function" == typeof a.async && 0 <= --_calls_ && a.async({
        static: a
    }.b, 4, --b + (a >>>= -((!1 | "" < 38..toString()) == (c += 1, -1))))] ? "function" == typeof a && 0 <= --_calls_ && a(!0, a++ + /[abc4]/.test(((c += 1) + !0 || b || 5).toString()), "undefined") : {
        ["crap" == typeof async_1]: {
            value: a++ + "foo"
        }
    }[(c += 1) + (a && a[b >>>= a])])) {
        var expr6 = (--b + ({} in {
            async: (c += 1) + b
        }) || 7).toString()[b >>>= a];
        for (a in expr6) {
            var b_1 = function(foo_2, foo_1) {
                var a_2, bar_1 = (c = 1 + c, a_2 = ({} ^ /[a2][^e]+$/) >> !1 == (bar_1 && (bar_1[(c += 1) + {
                    c: 0,
                    "\t": (c = 1 + (c = 1 + c), ("object" * (2 === [ , 0 ].length) != (bar_1 -= 0 !== [])) + (0 / 24..toString() ^ (bar_1 && (bar_1.async /= {} >> -2))))
                }.value] = (foo_1 && (foo_1[c = 1 + c, !1 & ~+38..toString()] /= NaN)) >= ~(2 === [ , 0 ].length))), 
                c = 1 + c, 24..toString(), c = 1 + (c = 1 + c), void (foo_1 && (foo_1[(c += 1) + (c = 1 + c, 
                ~(a_2 && (a_2[-1 in {
                    0: (c = 1 + c, (-0 < 23..toString()) << !1 + 23..toString() === (23..toString() >> 3 != (foo_2 && (foo_2[c = 1 + c, 
                    (!0 | (foo_1 && (foo_1.get = 1 != 24..toString()))) == (1 ^ (a_2 && (a_2[c = 1 + c, 
                    0 <= (a_2 += !1) <= !1] >>>= "number" & [])))] = -6))))
                }] /= ("bar" >>> 38..toString()) - ({} << "undefined"))) ? (c = 1 + c, 4 % (a_2 = -0 | 24..toString()) >> (foo_2 %= 3) + 38..toString()) : (c = 1 + c, 
                (foo_1 && (foo_1[c = 1 + c, !0 ^ (foo_2 ? foo_2[c = 1 + c, "bar" / 38..toString() / ~38..toString() <= 0] = 1 : NaN)] = !0)) < (!0 === (c += 1, 
                -5))))] = 38..toString() >> !0 << null)));
                c = 1 + (1 + c);
                !function(a, foo_2) {
                    c = 1 + c, foo_2 && (foo_2[c = 1 + c, -0 << ((a && (a.next *= !1)) >>> ("c" == []))] = !1), 
                    c = 1 + c;
                }();
                c = 1 + c, 38..toString();
                c = 1 + c, bar_1 && (bar_1.done = (c += 1, "number" !== ("number" == {}))), c = 1 + (c += 1), 
                c += 1;
            }();
        }
    }
}

console.log(null, a, b, c, 1 / 0, NaN, void 0);
original result:
null 14 2147483647 15 Infinity NaN undefined

uglified result:
null 15 1 15 Infinity NaN undefined
// reduced test case (output will differ)

// (beautified)
var a = 0;

({
    [0]: ++a,
    a: a >>>= 1,
    0: a,
    a: 0
})[0] ? 0 : a++;

console.log(a);
// output: 1
// 
// minify: 0
// 
// options: {
//   "mangle": false,
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "mangle": false,
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  objects
@alexlamsl alexlamsl added the bug label Dec 9, 2021
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Dec 9, 2021
alexlamsl added a commit that referenced this issue Dec 9, 2021
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