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

Closed
alexlamsl opened this issue Jan 4, 2022 · 0 comments · Fixed by #5265
Closed

ufuzz failure #5263

alexlamsl opened this issue Jan 4, 2022 · 0 comments · Fixed by #5265
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0() {
    {
        var brake1 = 5;
        while (-("function" * 23..toString() >= (23..toString() >= 38..toString()) != (a %= "number" ^ 38..toString(), 
        /[a2][^e]+$/ ^ 24..toString())) && --brake1 > 0) {
            var bar_2 = function f1(await_2, arguments_1) {
                {
                    var foo = function f2(await_2_1, a) {
                        function f3(bar_2, arguments_2, c_2) {
                            c = 1 + c, ("undefined" >= 5) / (-3 - "") & (a && (a[b = a] = (4 | "foo") ^ (c = c + 1, 
                            {})));
                            c = 1 + c, (a && (a[-5 in [ (c = 1 + c, 0 % -4 >= 23..toString() % 5 >= (3 > ([ , 0 ].length === 2) <= (4 !== -5))), ...[ (c = 1 + c, 
                            (arguments_1 && (arguments_1[c = 1 + c, a && (a.NaN = ((-1 && "c") == (c = c + 1, 
                            [])) > (-5 ^ this ?? "a" == true))] = 25 | [ , 0 ].length === 2)) < (4 != 3) > (bar_2 && (bar_2[a++ + 3] ||= "undefined" & "object" | 23..toString() <= "b"))), ...[ ...[ (c = 1 + c, 
                            await_2_1 >>>= "object" >>> 5 <= (5 ^ "number") ^ 25 % -5 == ~true), (c = 1 + c, 
                            ~(0 - "c") >> ((this !== "function") < (23..toString() != 1))) ] ], (c = 1 + c, 
                            !(false >> []) <= ("function" + -0 === (4 != "a"))) ], (c = 1 + c, a = 38..toString() * "function" > ("bar" != 1) || "a" >> false ^ "" & Number(0xdeadn << 16n | 0xbeefn)), (c = 1 + c, 
                            ~(-2 ^ false) ^ ((-2 && []) ?? [ , 0 ][1] >= "c")) ]] = (1 + "undefined") * (22, 
                            -0))) - (-0 < this & ({} || []));
                        }
                        var bar_1 = f3();
                        function f4() {
                            c = 1 + c, (c = c + 1, -3 - -0) >= (null <= "function" || 2 - 38..toString());
                            c = 1 + c, a >>= (await_2 && (await_2.value = ("undefined" | true) != ("object" || 24..toString()))) % (("c" && 4) === undefined < {});
                        }
                        var NaN = f4("", "object", (c = 1 + c, (NaN += (4 | 4) * ("a" >>> NaN)) ^ (this & 2) > "bar" << ([ , 0 ].length === 2)));
                        function f5() {
                            c = 1 + c, (false != Infinity) << (await_2_1 <<= 22 << "object") >= (NaN += [ , 0 ][1] & undefined) + ("object" ^ true);
                            c = 1 + c, (arguments_1 && (arguments_1[--b + [ (c = 1 + c, (3 === undefined) * ("object" >> "foo") || true !== [ , 0 ][1] == 22 >> "undefined") ].b] = -3 << "b" >> ("b", 
                            this))) != (a && (a.static &= false >> -0)) + (this << -5);
                        }
                        var bar_2 = f5(a++ + ~(("b" === 22) * (true >>> -0) * (("function" ^ Infinity) << (this & "a"))));
                    }();
                }
                {
                    var expr10 = a--;
                    for (var key10 in expr10) {
                        c = 1 + c;
                        var b_2 = expr10[key10];
                        try {
                            {
                                var brake12 = 5;
                                do {
                                    {
                                        var brake13 = 5;
                                        do {
                                            {
                                                var brake14 = 5;
                                                L16825: while ((c = 1 + c, (key10 ??= (22 <= 4) + (-4 < -4)) / ((-4 >> -0) * ("bar" >= 24..toString()))) && --brake14 > 0) {
                                                    c = 1 + c, (/[a2][^e]+$/ == "function") < (c = c + 1, "object") <= (-3 ?? 25 <= -1);
                                                }
                                            }
                                        } while (key10 && key10.a && --brake13 > 0);
                                    }
                                } while (typeof (0 === 1 ? a : b) && --brake12 > 0);
                            }
                        } finally {
                            switch ((c = c + 1) + !function() {
                            }()) {
                              case ((c = 1 + c, ({} * "number" ?? ("foo", "a")) >= (4 === 2 === "undefined" <= -5)) || a || 3).toString():
                                break;

                              default:
                                c = 1 + c, ~(("bar" >= 5) % (38..toString() || this));

                              case --b + (await_2 && typeof await_2.b == "function" && --_calls_ >= 0 && await_2.b((c = 1 + c, 
                                null < "number" > (1 || "a") < ([ , 0 ].length === 2 ^ "undefined" | 23..toString() !== [])), 2)):
                                c = 1 + c, (c = c + 1, "undefined" < "number") / (("a", []) != (c = c + 1, "c"));
                                break;

                              case /[abc4]/g.exec(((c = 1 + c, (24..toString() !== -0 ^ 2 > Infinity) % ("foo" != 5 ^ 24..toString() >>> 22)) || b || 5).toString()):
                                break;
                            }
                            for (var brake19 = 5; --b + void (c = c + 1, 4 < "", "number" | 23..toString()) && brake19 > 0; --brake19) {
                                break;
                            }
                        }
                    }
                }
            }(24..toString(), [ , 0 ].length === 2);
        }
    }
}

var b_2 = f0();

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

function f0() {
    for (var i, n, o = 5; a %= 38, 0 < --o; ) {
        var t = void 0, e = void 0, l = void 0, f = void 0, r = 2 === [ , 0 ].length;
        for (t in function() {
            c = 1 + c, n && (n[b = n] = 4 ^ (c += 1, {})), c = 1 + c, n && (n[-5 in [ (c = 1 + c, 
            (2 === [ , 0 ].length) < 3 <= !0 <= !1), (c = 1 + c, void 0 < ((r && (r[c = 1 + c, 
            n && (n.NaN = ("c" == (c += 1, [])) > (-5 ^ this ?? !1))] = 25 | 2 === [ , 0 ].length)) < !0)), i >>>= 1, -1 >> (("function" !== this) < !0), !1, n = 0 ^ "" & +("" + (0xdeadn << 16n | 0xbeefn)), (c = 1 + (1 + (1 + (1 + (1 + c)))), 
            1) ]] = NaN);
        }(), c = 1 + (1 + (1 + c) + 1), n >>= NaN, function() {
            i <<= 22, c = 1 + (1 + c), r && (r[--b + [ (c = 1 + c, !1) ].b] = -3 >> this), n && (n.static &= 0);
        }(n++), a--) {
            c = 1 + c;
            try {
                e = 5;
                do {
                    l = 5;
                    do {
                        for (f = 5; c = 1 + c, (t ??= 0) / -4 && 0 < --f; ) {
                            c = 1 + c, c += 1;
                        }
                    } while (t && t.a && 0 < --l);
                } while (0 < --e);
            } finally {
                switch ((c += 1) + !0) {
                  case c = 1 + c, (a || 3).toString():
                    break;

                  default:
                    c = 1 + c;

                  case --b + !1:
                    c = 1 + c, c += 1, c += 1;
                    break;

                  case /[abc4]/g.exec((c = 1 + c, (b || 5).toString())):
                }
                --b, c += 1;
            }
        }
    }
}

var b_2 = f0();

console.log(null, a, b, c, 1 / 0, NaN, void 0);
original result:
null 20 6 36 Infinity NaN undefined

uglified result:
null 20 0 66 Infinity NaN undefined
// reduced test case (output will differ)

// (beautified)
function f0() {
    var brake1 = 5;
    while (--brake1) {
        var bar_2 = function f1() {
            var foo = function f2(a) {
                a && 0(a);
                console.log(a);
                var bar_2 = a++;
            }();
            for (var key10 in 0) {
                brake12;
            }
        }();
    }
}

f0();
// output: undefined
// undefined
// undefined
// undefined
// 
// minify: undefined
// NaN
// NaN
// NaN
// 
// options: {
//   "compress": {
//     "passes": 1000000,
//     "sequences": 1000000,
//     "unsafe": true,
//     "unsafe_Function": true,
//     "unsafe_math": true,
//     "unsafe_proto": true,
//     "unsafe_regexp": true
//   },
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "compress": {
    "passes": 1000000,
    "sequences": 1000000,
    "unsafe": true,
    "unsafe_Function": true,
    "unsafe_math": true,
    "unsafe_proto": true,
    "unsafe_regexp": true
  },
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  inline
  passes
  reduce_vars
  sequences
  side_effects
  unused

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