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

Closed
alexlamsl opened this issue Jun 11, 2022 · 0 comments · Fixed by #5507
Closed

ufuzz failure #5506

alexlamsl opened this issue Jun 11, 2022 · 0 comments · Fixed by #5507
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

try {
    {
        var brake2 = 5;
        do {
            {
                var a_2 = function f0(await_1) {
                    async function f1() {
                        function f2() {
                            c = 1 + c, await_1 /= ([ , 0 ][1] <= false) + (await_1 && (await_1[c = 1 + c, 
                            (await_1 += (24..toString() && 1) < (-3 & Infinity)) == void (await_1 && (await_1[c = 1 + c, 
                            "b" < 23..toString() != (await_1 && ({
                                0: await_1.null
                            } = {
                                0: [ , 0 ][1] !== 25
                            })) | "a" % "bar" - (23..toString() >> 23..toString())] += [ , 0 ][1] ^ "function"))] &= -0 | "object")) in (([ , 0 ].length === 2) > "function") * (await_1 = true <= this);
                            c = 1 + c, ([ , 0 ][1] || "a", +3) - ((false !== 38..toString()) >>> (1 !== 25));
                        }
                        var a_2 = f2();
                    }
                    var foo_1 = f1(null in [ (c = 1 + c, (foo_1 += (-3 & "b") * (1 * "undefined")) ^ (false == 23..toString()) >= (22 > 4)), (c = 1 + c, 
                    ((-5 || -0) == (false | 4)) <= (foo_1 && (foo_1.var += [ , 0 ][1] % "b")) - (-1 - 23..toString())), (c = 1 + c, 
                    +("foo" < 2) > ("" / 24..toString() & /[a2][^e]+$/ >= 3)), (c = 1 + c, 
                    await_1 && (await_1.get = -([] >> false) & ~(NaN > -1))), (c = 1 + c, 
                    (5 === "object" == "object" - /[a2][^e]+$/) >> ~("foo" ^ null)) ]);
                    function f3() {
                        if (delete b) {
                        } else {
                            c = 1 + c, ((c = c + 1, "number") ^ 1 % this) % (c = c + 1, 
                            "b" | 2);
                        }
                        {
                            var brake9 = 5;
                            do {
                                switch (c = 1 + c, (4 % "number" && (c = c + 1, 
                                38..toString())) > ("function" >= "b" | (foo_1 && (foo_1[c = 1 + c, 
                                ("undefined" && Infinity) * (3 == 1) < (5 >= 4 && ([ , 0 ].length === 2) > 38..toString())] += 22 !== 25)))) {
                                  default:
                                    ;

                                  case c = 1 + c, ((-5 | 22) << 2 / this) / +(38..toString() > 1):
                                    ;

                                  case c = 1 + c, +((undefined | [ , 0 ].length === 2) + ("b" != -1)):
                                    ;

                                  case c = 1 + c, (2 >> NaN > (-3 < -5)) / ("undefined" << 4 ^ "bar" === /[a2][^e]+$/):
                                    ;
                                    break;
                                }
                            } while (a++ + (await_1 && await_1[c = 1 + c, (await_1 && (await_1.static += NaN ^ "object" ^ 25 & 2)) <= (([ , 0 ].length === 2 === []) < -2 / "bar")]) && --brake9 > 0);
                        }
                    }
                    var await_1_1 = f3(...[], "a");
                    function f4(foo_1, bar_1, foo_1) {
                        for (var brake11 = 5; (c = c + 1) + (typeof f3 == "function" && --_calls_ >= 0 && f3`${c = 1 + c, 
                        (1 <= 4) / (-2 <= NaN) >= ("undefined" < true & 25 >>> -0)}${c = 1 + c, 
                        ((foo_1 && (foo_1[c = 1 + c, (38..toString() > "c" || [] < -3) < (2 ^ "" ^ undefined + -0)] = Infinity < true)) <= (25 > 22)) % (2 >= 2 !== ([] != {}))}${c = 1 + c, 
                        (22 << undefined && [] <= "c") ^ Infinity < 23..toString() != (3 && true)}`) && brake11 > 0; --brake11) {}
                    }
                    var await_1 = f4();
                }("b");
            }
        } while (a++ + ("a" in {
            c: a++ + (a_2 && a_2[((c = c + 1) + (a_2 && a_2[(c = c + 1) + (typeof b_2 != "crap")]) || 0).toString()[--b + (a_2 = a_2 && typeof a_2.c == "function" && --_calls_ >= 0 && (-0 in [ typeof b_1 != "crap", void b, (c = c + 1) + (typeof f1 == "function" && --_calls_ >= 0 && f1(25, 0)) ], 
            a_2.c)(-2, -5, Infinity))]]),
            0: (c = c + 1) + (typeof c == "symbol") ? --b + a_2 : typeof a_2 == "function" && --_calls_ >= 0 && a_2(a++ + {
                done: -1 in {
                    get: (c = 1 + c, (3 & false) >> ("function" !== 2) | (a_2 && (a_2.value = -4 && [ , 0 ][1]), 
                    a_2 && (a_2[c = 1 + c, ("a" >= null !== (a_2 && (a_2[c = 1 + c, 
                    (a_2 &= Infinity && []) + (-0 << 2) - (NaN + ([ 3n ][0] > 2) != ("undefined" == "bar"))] += "function" != false))) * (a_2 && (a_2[a++] &= (a_2 = 5 && -2) * ({} ^ "")))] **= -3 == -3))),
                    1.5(bar_1, bar_2) {
                        bar_1 %= super.static;
                        this[c = 1 + c, (c = c + 1, 5) / (-1 > "b") & (c = c + 1, 
                        c = c + 1, -3)] += /[a2][^e]+$/ ^ 38..toString();
                    },
                    Infinity: (c = 1 + c, "object" / 3 > ("b" | [ , 0 ][1]) && -5 >>> 2 >= ({} ^ "b"))
                },
                done: a++ + /[abc4]/.test(((c = 1 + c, (null <= ([ , 0 ].length === 2)) * (a_2 && (a_2[c = 1 + c, 
                (4, "a") % (-4 % NaN) ^ 25 !== "number" == (a_2 && (a_2[c = 1 + c, 
                "" < false !== (true != -4) || +("c" !== "number")] += "object" <= undefined))] = [ , 0 ][1] != "foo")) & void -5 >>> NaN / -1) || b || 5).toString()),
                [a++ + /[abc4]/.test(((c = 1 + c, ("b" >= NaN) / ("object" >>> -5) << ([ , 0 ][1] >= undefined) + delete -1) || b || 5).toString())]: (c = c + 1) + (typeof a_2 == "function" && --_calls_ >= 0 && a_2()),
                0: --b + ((c = 1 + c, (false !== Infinity !== -2 >> "bar") ** ("undefined" >>> {} >= ("function" | NaN))) ? (c = 1 + c, 
                (("c" ^ []) !== -2 - "function") >>> (c = c + 1, /[a2][^e]+$/ * 22)) : (c = 1 + c, 
                "a" >>> 24..toString() >> (NaN != Number(0xdeadn << 16n | 0xbeefn)) <= ((24..toString(), 
                "bar") ^ 2 << 2))),
                in: (c = 1 + c, ("c" < 25, "object" === 1) | ([] ^ 5) == "b" > -0) ? (c = 1 + c, 
                (5 ^ "") + -1 % 24..toString() ^ ("c" ^ "bar" ^ "undefined" <= -0)) : (c = 1 + c, 
                (a_2 <<= (4 ^ 5) - (22 == undefined)) <= ((a_2 = -4 * "function") >= (true ^ "a")))
            } ? (c = c + 1) + (0 === 1 ? a : b) : function arguments(a_2) {
                {
                    return;
                    c = 1 + c, (a_2 && (a_2.in ^= null - "c" === ("a" || "function"))) == ("" || "c") <= [] >>> -5;
                }
                try {
                    c = 1 + c, ((a_2 && (a_2[c = 1 + c, ((arguments && (arguments.get = 2 && this)) ^ delete "undefined") % (([ , 0 ].length === 2) >= "a" ^ null != -1)] = {} << [ , 0 ][1])) <= (false < "function")) >>> (4 >> -1 > (arguments && (arguments.foo = this <= "c")));
                } catch (yield_2) {
                } finally {
                }
                if (c = 1 + c, (a_2 && ([ a_2.value ] = [ {} == true ])) <= ({}, 
                [ , 0 ][1]) != false >>> [] < (-1 == "number")) {
                    c = 1 + c, (c = c + 1, "b", -4) && 24..toString() >>> "b" >> ("c" === 2);
                }
            }, "object", {
                a_2: a_2,
                static: {
                    in: (c = 1 + c, (/[a2][^e]+$/ == 24..toString()) >> ("object" < 22), 
                    ("number" == "bar") / ("number" | this))
                }[a++ + (a_2 && typeof a_2.c == "function" && --_calls_ >= 0 && (c = 1 + c, 
                c = c + 1, ("b" && -5) >= (this === 4), a_2.c)(""))],
                "": typeof f1 == "function" && --_calls_ >= 0 && f1(),
                c: a_2 && typeof a_2.undefined == "function" && --_calls_ >= 0 && a_2.undefined`${c = 1 + c, 
                c = c + 1, -1 != false !== (a_2 && ({
                    then: a_2[c = 1 + c, c = c + 1, a_2 && (a_2.next += (25 << 25) + ("b", 
                    Infinity))]
                } = {
                    then: {} || [ , 0 ][1]
                }))}
${c = 1 + c, c = c + 1, a_2 && (a_2.in = (-3 ^ -1) != (-3 ^ undefined))}
${c = 1 + c, "" % "b" ^ undefined << 24..toString() || (a_2 += (24..toString() != "") % (4 >= false))}
${c = 1 + c, (c = c + 1, "function", 25) !== (null >>> 38..toString() | [] < "undefined")}`,
                next: a++ + (1 === 1 ? a : b)
            }[/[abc4]/g.exec(((c = c + 1) + (b = a) || b || 5).toString())]),
            ...--b + (b-- || 5).toString()[--b + (a_2 && a_2.b)],
            b: a++ + delete b
        }) && --brake2 > 0);
    }
} catch (a_2) {
    {
        var a = function f5([], arguments_1) {
            {
                var brake21 = 5;
                L10307: do {
                    {
                        var yield_1 = function bar_1() {
                            {
                                c = 1 + c, ((-5 && -2) << "a" * 4) - ("foo" ^ -4 && true <= "object");
                                c = 1 + c, delete (24..toString() % 0 | 25 < Number(0xdeadn << 16n | 0xbeefn));
                                c = 1 + c, (22 % -2 | "a" < 2) % (arguments_1 && (arguments_1.foo = [] > 2 ^ ([ , 0 ].length === 2, 
                                22)));
                                c = 1 + c, c = c + 1, ("function" === undefined) / (0 - this);
                            }
                            c = c + 1;
                        }(null);
                    }
                } while (a++ + ++a && --brake21 > 0);
            }
            {
                c = c + 1;
            }
        }([], a_2, b--);
    }
} finally {}

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

try {
    var brake2 = 5;
    do {
        var a_2 = function(await_1) {
            var foo_1 = async function() {
                (function() {
                    c = 1 + c, await_1 /= !0 + (await_1 && (await_1[c = 1 + c, (await_1 += (24..toString() && 1) < 0) == void (await_1 && (await_1[c = 1 + c, 
                    "b" < 23..toString() != (await_1 && ({
                        0: await_1.null
                    } = {
                        0: !0
                    })) | NaN - (23..toString() >> 23..toString())] += 0))] &= 0)) in ("function" < (2 === [ , 0 ].length)) * (!0 <= this), 
                    c = 1 + c, 38..toString();
                })();
            }((c = 1 + c, foo_1 += NaN, 23..toString(), c = 1 + c, foo_1 && (foo_1.var += NaN), 
            23..toString(), c = 1 + c, 24..toString(), c = 1 + c, await_1 && (await_1.get = -1 & -([] >> !1)), 
            c = 1 + c));
            function f3() {
                delete b || (c = (c = 1 + c) + 1 + 1);
                var brake9 = 5;
                do {
                    switch (c = 1 + c, (!0 | (foo_1 && (foo_1[c = 1 + c, NaN < ((2 === [ , 0 ].length) > 38..toString())] += !0))) < NaN) {
                      default:
                      case c = 1 + c, (-1 << 2 / this) / (1 < 38..toString()):
                      case c = 1 + c, (void 0 | 2 === [ , 0 ].length) + !0:
                      case c = 1 + c, 1 / 0:
                    }
                } while (a++ + (await_1 && await_1[c = 1 + c, (await_1 && (await_1.static += 0)) <= ((2 === [ , 0 ].length === []) < NaN)]) && 0 < --brake9);
            }
            f3();
            await_1 = function(foo_1, foo_1) {
                for (var brake11 = 5; (c += 1) + (0 <= --_calls_ && f3`${c = 1 + c, 
                !0}${c = 1 + c, ((foo_1 && (foo_1[c = 1 + c, ("c" < 38..toString() || [] < -3) < 2] = !1)) <= !0) % (!0 != ([] != {}))}${c = 1 + c, 
                [] <= "c" ^ 1 / 0 < 23..toString() != !0}`) && 0 < brake11; --brake11) {}
            }();
        }("b");
    } while (a++ + ("a" in {
        c: a++ + (a_2 && a_2[((c += 1) + (a_2 && a_2[(c += 1) + ("crap" != typeof b_2)]) || 0).toString()[--b + (a_2 = a_2 && "function" == typeof a_2.c && 0 <= --_calls_ && (c += 1, 
        "function" == typeof f1 && 0 <= --_calls_ && f1(25, 0), a_2.c)(-2, -5, 1 / 0))]]),
        0: (c += 1) + ("symbol" == typeof c) ? --b + a_2 : "function" == typeof a_2 && 0 <= --_calls_ && a_2(a++ + {
            done: -1 in {
                get: (c = 1 + c, 0 | (a_2 && (a_2.value = 0), a_2 && (a_2[c = 1 + c, 
                (!1 !== (a_2 && (a_2[c = 1 + c, (a_2 &= []) - (NaN + (2 < 3n) != 0)] += !0))) * (a_2 && (a_2[a++] &= (a_2 = -2) * ("" ^ {})))] **= !0))),
                1.5(bar_1, bar_2) {
                    super.static, this[c = 1 + c, 1 / 0 & (c = (c += 1) + 1 + 1, 
                    -3)] += /[a2][^e]+$/ ^ 38..toString();
                },
                Infinity: (c = 1 + c, !1)
            },
            done: a++ + /[abc4]/.test((c = 1 + c, ((null <= (2 === [ , 0 ].length)) * (a_2 && (a_2[c = 1 + c, 
            NaN ^ 1 == (a_2 && (a_2[c = 1 + c, !0] += !1))] = !0)) & 0 || b || 5).toString())),
            [a++ + /[abc4]/.test((c = 1 + c, (b || 5).toString()))]: (c += 1) + ("function" == typeof a_2 && 0 <= --_calls_ && a_2()),
            0: --b + (c = 1 + c, (!0) ** (0 <= "undefined" >>> {}) ? (c = 1 + c, 
            (NaN !== ("c" ^ [])) >>> (c += 1, NaN)) : (c = 1 + c, "a" >>> 24..toString() >> (NaN != Number(0xdeadn << 16n | 0xbeefn)) <= (8 ^ (24..toString(), 
            "bar")))),
            in: (c = 1 + c, !1 | 0 == (5 ^ []) ? (c = 1 + c, 5 + -1 % 24..toString() ^ 0) : (c = 1 + c, 
            (a_2 <<= 1) <= (1 <= (a_2 = NaN))))
        } ? (c += 1) + b : function(a_2) {}, "object", {
            a_2: a_2,
            static: {
                in: (c = 1 + c, 24..toString(), !1 / ("number" | this))
            }[a++ + (a_2 && "function" == typeof a_2.c && 0 <= --_calls_ && (c = 1 + c, 
            c += 1, a_2.c)(""))],
            "": "function" == typeof f1 && 0 <= --_calls_ && f1(),
            c: a_2 && "function" == typeof a_2.undefined && 0 <= --_calls_ && a_2.undefined`${c = 1 + c, 
            c += 1, !0 !== (a_2 && ({
                then: a_2[c = 1 + c, c += 1, a_2 && (a_2.next += 1 / 0)]
            } = {
                then: {}
            }))}
${c = 1 + c, c += 1, a_2 && (a_2.in = !0)}
${c = 1 + c, NaN ^ void 0 << 24..toString() || (a_2 += ("" != 24..toString()) % !0)}
${c = 1 + c, c += 1, 25 != (null >>> 38..toString() | [] < "undefined")}`,
            next: a++ + a
        }[/[abc4]/g.exec(((c += 1) + (b = a) || b || 5).toString())]),
        ...--b + (b-- || 5).toString()[--b + (a_2 && a_2.b)],
        b: a++ + delete b
    }) && 0 < --brake2);
} catch (a_2) {
    a = function(arguments_1) {
        var brake21 = 5;
        do {
            c = 1 + (c = 1 + c), 24..toString(), Number(0xdeadn << 16n | 0xbeefn), 
            c = 1 + c, arguments_1 && (arguments_1.foo = 2 < [] ^ 22), c = (c = 1 + c) + 1 + 1;
        } while (a++ + ++a && 0 < --brake21);
        c += 1;
    }(a_2, b--);
}

console.log(null, a, b, c, 1 / 0, NaN, void 0);
original result:
null 165 -10 345 Infinity NaN undefined

uglified result:
null 125 -10 155 Infinity NaN undefined
// reduced test case (output will differ)

// (beautified)
(function f0(await_1) {
    async function f1() {
        await_1 /= 0 in (await_1 = console.log());
    }
    f1();
    await_1[0];
})("b");
// output: TypeError: Cannot read property '0' of undefined
// minify: 
// 
// options: {
//   "mangle": false,
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "mangle": false,
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  dead_code
@alexlamsl alexlamsl added the bug label Jun 11, 2022
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Jun 11, 2022
alexlamsl added a commit that referenced this issue Jun 11, 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