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

Closed
alexlamsl opened this issue Nov 2, 2022 · 0 comments · Fixed by #5731
Closed

ufuzz failure #5730

alexlamsl opened this issue Nov 2, 2022 · 0 comments · Fixed by #5731
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

class C0 {
    async(a_2) {
        switch (b = a) {
          case (a_2 && a_2[[][a++ + +async function() {
                return --b + typeof b;
            }()]] || 3).toString()[--b + {}.static]:
            typeof a_2 == "function" && --_calls_ >= 0 && a_2();
            L61042: {
                {
                    var brake5 = 5;
                    while ((a_2 = a++ + this) && --brake5 > 0) {
                        return --b + (a_2 && typeof a_2.var == "function" && --_calls_ >= 0 && a_2.var(a++ + (typeof a_2 == "function" && --_calls_ >= 0 && a_2(24..toString(), NaN))));
                    }
                }
                {
                    var foo_2 = function f0(b, async_2) {
                        try {
                            {
                                c = 1 + c, ((Object.isExtensible(b) && (b.then = [ , 0 ][1] - [ , 0 ][1])) ^ "c" == /[a2][^e]+$/) != (3 + NaN || ([ , 0 ].length === 2) > -1);
                                c = 1 + c, (25 <= 0) - (23..toString() <= this) & void (c = c + 1, 
                                -3);
                                c = 1 + c, (25 & 0) / -22 == ((25 && false) ^ (-1 ^ 3));
                            }
                        } catch (Infinity_1) {
                            return c = 1 + c, ("number" - NaN) / (Infinity_1 = 0 <= "foo") ^ (Object.isExtensible(b) && (b.next += "b" ^ false)) != 22 <= "b";
                            if (c = 1 + c, "bar" % -5 > +this >= ("number" >= "") >>> (-3 < NaN)) {
                                c = 1 + c, (c = c + 1, "number" * NaN) ^ Infinity !== -0 != (Object.isExtensible(Infinity_1) && (Infinity_1.in %= [] % ""));
                            }
                        }
                        {
                            var undefined_2 = function f1(async_2, a_1, b_1) {
                                c = 1 + c, Object.isExtensible(b) && (b[a_1 && typeof a_1.Infinity == "function" && --_calls_ >= 0 && a_1.Infinity(22)] = (4 + 2 == NaN + true) / ((Object.isExtensible(a_1) && (a_1.foo += "function" / 25)) != "object" % ([ , 0 ].length === 2)));
                            }(null, (c = c + 1) + --b);
                        }
                    }(...[ (c = c + 1) + !(((2 & []) >>> ("foo" !== 23..toString())) - ((undefined != -1) + (null == "number"))) ]);
                }
            }
            break;

          case --b + void function() {
                try {
                    switch (--b + (typeof f2 == "function" && --_calls_ >= 0 && f2())) {
                      case --b + (("number" && 3) !== (/[a2][^e]+$/ == /[a2][^e]+$/) | 3 * 25 / (24..toString() ^ "undefined")):
                        if (--b + (a_2 && typeof a_2.foo == "function" && --_calls_ >= 0 && a_2.foo())) {
                            var Infinity = (c = c + 1) + (a_2 && a_2.null), c_2 = --b + (a_2 = (c = 1 + c, 
                            Object.isExtensible(c_2) && (c_2.then |= ((1 ^ NaN) >> (25 > 2)) - (c = c + 1, 
                            [ , 0 ].length === 2) % (25 & -2))));
                        }
                        break;

                      default:
                        try {
                            if (([ c_2 ] = [])) {
                                var brake24 = 5;
                                while ((c = 1 + c, Object.isExtensible(a_2) && (a_2[[].a] += (22 === "function") + ("object" << 0)), 
                                24..toString() << Infinity >= 2 / 22) && --brake24 > 0) {
                                    c = 1 + c, (("foo" ^ -0) == (Object.isExtensible(a_2) && (a_2[c = 1 + c, 
                                    (c_2 = ("" != /[a2][^e]+$/) > {} - 0) <= (Object.isExtensible(c_2) && (c_2.c = (c = c + 1, 
                                    NaN, /[a2][^e]+$/ !== "a")))] = 22 + "function"))) >> (25 ^ this) - (-4 < /[a2][^e]+$/);
                                }
                            } else {
                                c = c + 1;
                            }
                        } catch (let_2) {
                            c = 1 + c, ((c = c + 1, 4) ^ (NaN, true)) == (("" ^ 3) & ("" | "undefined"));
                            {
                                var expr28 = (c = 1 + c, (Object.isExtensible(c_2) && (c_2[c = 1 + c, 
                                2 >= 4 > (c = c + 1, "object") === (-3 % "b", [] % "b")] >>= (/[a2][^e]+$/, 
                                5))) > (a_2 = undefined >> true) | (this, "bar") << (false | 2));
                                for (var key28 in expr28) {
                                    c = 1 + c;
                                    var arguments_1 = expr28[key28];
                                    c = 1 + c, c = c + 1, ({} ^ 24..toString()) % (5 << "c");
                                }
                            }
                            {
                                var expr30 = (c = 1 + c, ~((Infinity ^ []) < "bar" << "object"));
                                L61043: for (var [ key30 ] in expr30) {
                                    c = 1 + c;
                                    var a_2 = expr30[key30];
                                    c = 1 + c, (-5 < "b" && (Object.isExtensible(a_2) && (a_2[c = 1 + c, 
                                    (Object.isExtensible(a_2) && (a_2.undefined = 5 || "foo")) == [] <= 38..toString(), 
                                    38..toString() - 22 ^ 3 % -1] = 38..toString() == "a"))) >>> (![] == ([ , 0 ].length === 2) >> this);
                                }
                            }
                        } finally {
                            class C1 {
                                set = (c = 1 + c, c = c + 1, (c_2 = 4 >> NaN) ^ "undefined" >= "foo") ? (c = 1 + c, 
                                Object.isExtensible(a_2) && (a_2.a += (0 >>> null < (c = c + 1, 
                                "c")) % (false % -3 || 23..toString() + "foo"))) : (c = 1 + c, 
                                (("undefined" ^ 3) > 25 >>> 23..toString()) * (2 + -3 != ("number" != "b")));
                                in = -((25 !== 1) >> ("number" == 1) < ((Object.isExtensible(a_2) && ({
                                    foo: a_2.NaN
                                } = {
                                    foo: 1 === -4
                                })) >= undefined << -0));
                                null(a, c_2) {
                                    c = 1 + c, (a = 2 >> -5 | [] !== {}) / (Object.isExtensible(c_2) && (c_2[--b + /[abc4]/g.exec(((c = 1 + c, 
                                    ((-3 && Infinity) === ("c" ^ /[a2][^e]+$/)) >>> !("foo" && -1)) || b || 5).toString())] += -1 + -4 - ("" ^ 24..toString())));
                                }
                                value = a++ + (typeof f0 == "function" && --_calls_ >= 0 && f0());
                            }
                        }

                      case a++ + ((Object.isExtensible(c_2) && (c_2.next = this % 5 / ("a" >= 23..toString()))) <= (5 ^ 2) - ("foo" || [ , 0 ][1])):
                        {
                            var brake33 = 5;
                            L61044: while ((c = c + 1) + (-5 << 22 === -0 - "undefined" | undefined << [] >= (0 & 25)) && --brake33 > 0) {
                                c_2 |= (c = 1 + c, ([ , 0 ][1] != 2) << (c = c + 1, 
                                "foo") < -3 - 4 + ("b" == 3));
                            }
                        }
                        break;

                      case (c = c + 1) + {
                            b: (b += a) ? /[abc4]/g.exec(((c = 1 + c, ({} ^ "foo" | 24..toString() << -0) !== (c = c + 1, 
                            [ , 0 ][1] && "number")) || b || 5).toString()) : b--,
                            then: --b + (b += a),
                            1.5: --b + (0 === 1 ? a : b),
                            b: --b + (25 in {
                                get: (c = 1 + c, void (c_2 = (-4, -3) << (Object.isExtensible(Infinity) && (Infinity.done += {} !== undefined)))),
                                get: (c = 1 + c, /[a2][^e]+$/ != "a" === -2 + {} != (null !== "number") < (NaN ^ (-42n).toString()))
                            }),
                            b: --b + (a_2 |= (c = c + 1) + typeof await_1)
                        }.var:
                        --b + {
                            NaN: (c = 1 + c, "function" >> 23..toString() >> "c" - "undefined" ^ -(23..toString() || -2))
                        }[c = 1 + c, (2 == 1) <= ("function" & "function") | -1 ^ [] ^ 5 >= [ , 0 ][1]] ? b %= a : (c = c + 1) + Infinity;
                        switch (typeof c_2 == "function" && --_calls_ >= 0 && c_2((c = 1 + c, 
                        +!"c" + ((-5 | Number(0xdeadn << 16n | 0xbeefn)) == (NaN ^ []))))) {
                          default:
                          case (c = c + 1) + "a":
                            break;

                          case --b + {
                                ...a_2
                            }[typeof c_2 == "function" && --_calls_ >= 0 && c_2()]:
                            if (c = 1 + c, ("" | "a") >= "undefined" / 23..toString() && Infinity / true ^ "undefined" < !0o644n) {
                                c = 1 + c, c = c + 1, "object" != undefined, Object.isExtensible(c_2) && (c_2[a_2 && a_2.set] += 5 / 25 - (true < "number"));
                            } else {
                                c = 1 + c, ((c = c + 1, 23..toString()) ^ 24..toString() - {}) <= (this < -3) >>> (Object.isExtensible(a_2) && (a_2.async |= 3 | "bar"));
                            }
                            break;

                          case Infinity:
                            if (c = 1 + c, (Object.isExtensible(Infinity) && (Infinity[typeof Infinity == "function" && --_calls_ >= 0 && Infinity()] = (2 && 38..toString()) !== (-3 ^ -4))) > ((c = c + 1, 
                            3) ^ "undefined" > "a")) {
                                c = 1 + c, !(-5 < 3 & (5, 3));
                            } else {
                                c = 1 + c, "" << Infinity < (38..toString() != "object") === (c_2 += 38..toString() / NaN << (4 << 1));
                            }
                            break;
                        }
                        break;
                    }
                } finally {}
            }() ? typeof f3 == "function" && --_calls_ >= 0 && f3({
                set: {}
            }[a_2 && typeof a_2.then == "function" && --_calls_ >= 0 && a_2.then(..."" + a_2)]) : a++ + a_2:
            {
                var await = function f2(a_2_2 = true, foo_2, a_2) {}();
            }
            {
                var expr44 = [];
                for (var key44 of expr44) {
                    c = 1 + c;
                    let b_2 = expr44[key44];
                    {
                        var await_2 = ((c = c + 1) + (25 in {
                            ...a_2
                        }) || 4).toString()[b_2 && typeof b_2.set == "function" && --_calls_ >= 0 && b_2.set([ (c = 1 + c, 
                        (22 * null && ~true) * ((NaN && this) >> ("object" <= "number"))) ], --b + (typeof key44 == "function" && --_calls_ >= 0 && key44``))];
                    }
                }
            }
            {
                var brake47 = 5;
                while (b-- && --brake47 > 0) {
                    return typeof f0 == "function" && --_calls_ >= 0 && f0();
                }
            }
            break;

          default:
            for (var brake49 = 5; a++ + a_2 && brake49 > 0; --brake49) {
                var brake50 = 5;
                while (/[abc4]/g.exec(((++a || a || 3).toString() || b || 5).toString()) && --brake50 > 0) {
                    !function foo_1() {}();
                }
            }
            c = c + 1;
            {
                var Infinity = function bar_1(arguments_1) {
                    {
                        var expr56 = void function() {
                            L61046: for (var brake57 = 5; --b + ((-4 & "number") != (Object.isExtensible(a_2) && (a_2[c = 1 + c, 
                            (~-0 ^ (4 ^ "b")) * void (23..toString() < this)] *= 2 + "c")) === (4 & -5) / (([ , 0 ].length === 2) >= -1)) && brake57 > 0; --brake57) {
                                c = 1 + c, (0 == "" & (c = c + 1, "c")) / void ("foo" >= []);
                            }
                        }();
                        L61045: for (var key56 in expr56) {
                            c = 1 + c;
                            var a_2_2 = expr56[key56];
                            var Infinity_1;
                        }
                    }
                    var a = a++ + typeof !~((-1 !== null) < (24..toString() || 0));
                }(void function() {
                    {
                        var brake54 = 5;
                        do {
                            var b = (c = c + 1) + --b;
                        } while (/[abc4]/.test((((c = c + 1) + ("foo" in [ (c = 1 + c, 
                        ((await = 22 * -4) | "foo" >= "a") + (2 == 23..toString() === ~false)) ]) ? b && typeof b.in == "function" && --_calls_ >= 0 && b.in(-1, (c = 1 + c, 
                        (b += ~[ , 0 ][1] < (Object.isExtensible(b) && ([ b[c = 1 + c, 
                        Object.isExtensible(a_2) && ([ a_2.var ] = [ ((0 <= false) >>> ([] & 38..toString())) / (-2 <= -3 == (this && 4)) ])] ] = [ "number" != 0 ]))) & 5 == 1 != 24..toString() % "foo"), (c = 1 + c, 
                        Object.isExtensible(await) && (await[a++ + (b && b.value)] |= (Object.isExtensible(a_2) && ({
                            c: a_2[(c = c + 1) + 3]
                        } = {
                            c: (22 === false) + (-4 > -2)
                        })) % (0 >> "c" & 22 % 25)))) : a++) || b || 5).toString()) && --brake54 > 0);
                    }
                }());
            }

          case void (([ , 0 ][1] || [ , 0 ][1]) > 38..toString() * null != ((0 ^ -5) & (a_2 += true >>> -4))):
            {
                var expr61 = (c = c + 1) + {};
                for (var key61 in expr61) {
                    {
                        var brake62 = 5;
                        do {
                            try {
                                if ((c = c + 1) + (await && typeof await.static == "function" && --_calls_ >= 0 && await.static(38..toString())) ? (c = c + 1) + +((38..toString() >> -5 && (c = c + 1, 
                                -0)) << (({} ^ -1) & NaN === 24..toString())) : (void (23..toString() % 25 == 2 * null && false % 2 * ("foo" != "undefined")) || a || 3).toString()) {
                                    for (var brake65 = 5; (c = c + 1) + {
                                        length: key61 && key61.b,
                                        [a++]: (Object.isExtensible(key61) && (key61[c = 1 + c, 
                                        "number" != -2 !== (-3 ^ 3) ^ (Object.isExtensible(key61) && ({
                                            NaN: key61.NaN
                                        } = {
                                            NaN: ("foo" != undefined) < (null && "undefined")
                                        }))] = [ , 0 ].length === 2 !== 23..toString())) & "" in "a" && (Infinity ^ -3) < (5 || 22)
                                    } && brake65 > 0; --brake65) {
                                        var b_1 = (c = c + 1) + (typeof f3 == "function" && --_calls_ >= 0 && f3(this));
                                    }
                                } else if (+(("foo" ^ 0) << (await += false <= undefined) || this + -4 && 1 | 4)) {} else {}
                            } catch (await_1) {}
                        } while ((c = c + 1) + void a && --brake62 > 0);
                    }
                }
            }
            ;
            break;
        }
    }
    undefined = ((typeof f0 == "function" && --_calls_ >= 0 && f0([], 0, -3) ? typeof a == "function" && --_calls_ >= 0 && a(typeof f3 == "function" && --_calls_ >= 0 && f3([ , 0 ][1], --b + +((25 > 25) >>> ({} >>> "bar") && ([] && -0) === 1 / 23..toString()), Infinity)) : [ , 0 ][1]) || 1).toString()[a++ + (b = a)];
    static async = a--;
}

try {
    var await_1 = function(arguments_2, a_1) {
        --b + (1 in {
            get: arguments_2 = b = a
        });
    };
} finally {
    var a_2 = {
        1.5: [ true ]
    }, a_2 = --b + (b = a);
}

[ (c = c + 1) + (typeof await_1 == "function" && --_calls_ >= 0 && await_1(undefined)), a++ + await_1, 22 in [], 23..toString(), b-- ].a;

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

try {
    n = function(arguments_2, a_1) {
        --o, o = 100;
    };
} finally {
    --o, o = 99;
}

"function" == typeof n && n(void 0), console.log(null, 100, --o, 1, Infinity, NaN, void 0);
original result:
null 100 98 1 Infinity NaN undefined

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

// (beautified)
var a;

try {
    var await_1 = function() {
        console.log(a);
    };
} finally {}

[ await_1(), a++ ];
// output: undefined
// 
// minify: NaN
// 
// options: {
//   "compress": {
//     "hoist_vars": true,
//     "keep_infinity": true,
//     "passes": 1000000,
//     "unsafe": true
//   },
//   "keep_fargs": true,
//   "keep_fnames": true,
//   "toplevel": true,
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "compress": {
    "hoist_vars": true,
    "keep_infinity": true,
    "passes": 1000000,
    "unsafe": true
  },
  "keep_fargs": true,
  "keep_fnames": true,
  "toplevel": true,
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  evaluate
  passes
  reduce_vars
  side_effects
  unused

Suspicious options:
  toplevel
@alexlamsl alexlamsl added the bug label Nov 2, 2022
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Nov 3, 2022
alexlamsl added a commit that referenced this issue Nov 3, 2022
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